title: Get array keys object PHP
body: <p>Ok.
  I need to get keys, i think they they are called keys.</p>
  
  <p>When i var_dump object i get </p>
  
  <pre><code>object(stdClass)#6 (7) { ["id"]=&gt; string(1) "2" 
  ["title"]=&gt; string(14) "Old wood table" 
  ["price"]=&gt; string(2) "25" 
  ["size_w"]=&gt; string(2) "65" 
  ["size_h"]=&gt; string(2) "50" 
  ["size_l"]=&gt; string(2) "60"
  ["material"]=&gt; string(4) "wood" }
  </code></pre>
  
  <p>Code itself</p>
  
  <pre><code>$catalog = new Catalog('furniture',2);
  if(!$catalog-&gt;exists()){
      die('Product dose not exist');
  }else{
      $product = $catalog-&gt;data();
  }
  echo $product-&gt;title;
  var_dump($product);
  $productsArray = get_object_vars($product);
  
  foreach($productsArray as $attribute){
     echo  $attribute . '&lt;br/&gt;';  
  }
  </code></pre>
  
  <p>For now i am getting back</p>
  
  <pre><code>2
  Old wood table
  25
  65
  50
  60
  wood
  </code></pre>
  
  <p>Result i need</p>
  
  <pre><code>id-2
  title-foo
  price-25
  size_w-65
  size_h-50
  size_l-60
  material-wood
  </code></pre>
  
  <p>I tried to use key(array) and next(array) </p>
  
  <pre><code>foreach($productsArray as $attribute){
  
     echo key($productsArray) . '- ' . $attribute . '&lt;br/&gt;';
     next($productsArray);
  }
  </code></pre>
  
  <p>but the results was </p>
  
  <pre><code>title- 2
  price- Old wood table
  size_w- 25
  size_h- 65
  size_l- 50
  material- 60
  - wood
  </code></pre>
  
  <p>It seems like it's skipping id key.
  Any ideas? Thanks</p>