title: Popping the key & value from an associative array in PHP
body: <p>Let S be an associative array in PHP, I need to retrieve and extract from it the first element, both the value and the key.</p>
  
  <p>I would use </p>
  
  <pre><code>value1=array_pop(S);
  </code></pre>
  
  <p>but it only gives me the value.</p>
  
  <p>I can use </p>
  
  <pre><code>K=array_keys(S);
  key1=array_pop(K);
  value1=array_pop(S);
  </code></pre>
  
  <p>but it is complicated because it requires to have two copies of the same data. WHich is a confusing since the array is itself an element in an array of arrays. There must be a more elegant way to just read the couple key/value while extracting it.</p>