title: PHP - how to get nth(first, second, etc) key and value for array?
body: <p>I have array :</p>
  
  <pre><code>$test = ['10' =&gt; 'a', '20' =&gt; 'b'];
  </code></pre>
  
  <p>I want get key and value for first and second element, e.g. something like</p>
  
  <pre><code>echo 'first array key is ' . array_key($test, 0);//10
  echo 'second array key is ' . array_key($test, 1);//a
  echo 'first array value is ' . array_value($test, 0);//20
  echo 'second array value is ' . array_value($test, 1);//b
  </code></pre>
  
  <p>any ideas ? </p>
  
  <p>PS. I don't want solution with </p>
  
  <pre><code>foreach ($test as $key =&gt; $value ){...
  </code></pre>