title: PHP, how to get the Array Key in Single Dimensional Array.
body: <p>In PHP I create an array of key value pairs like this, how to I get "mykey"?</p>
  
  <pre><code>$arr = array("mykey"=&gt;"myvalue");
  </code></pre>
  
  <p>I know the code below will work, but I am interested to know if there is a language construct in PHP that allows me to this in a easier fashion.</p>
  
  <pre><code>foreach($arr as $key=&gt;$value){
    $result = $key;
    break;
  }
  echo $result;
  </code></pre>