title: PHP: How to print associative array using while loop?
body: <p>I have a simple associative array.</p>
  
  <pre><code>&lt;?php
  $assocArray = array('a' =&gt; 1, 'b' =&gt; 2, 'c' =&gt; 3);
  ?&gt;
  </code></pre>
  
  <p>Using only while loop, how can I print it in this result?</p>
  
  <pre><code>$a = 1 
  $b = 2 
  $c = 3
  </code></pre>
  
  <p>This is my current solution but I think that this is not the efficient/best way to do it?</p>
  
  <pre><code>&lt;?php
  $assocArray = array('a' =&gt; 1, 'b' =&gt; 2, 'c' =&gt; 3);
  $keys = array_keys($assocArray);
  rsort($keys);
  
  while (!empty($keys)) {
      $key = array_pop($keys);
      echo $key . ' = ' . $assocArray[$key] . '&lt;br /&gt;';
  };
  ?&gt;
  </code></pre>
  
  <p>Thanks.</p>