title: PHP - Get key name of array value
body: <p>I have an array as the following:</p>
  
  <pre><code>function example() {
      /* some stuff here that pushes items with
          dynamically created key strings into an array */
  
      return array( // now lets pretend it returns the created array
          'firstStringName' =&gt; $whatEver,
          'secondStringName' =&gt; $somethingElse
      );
  }
  
  $arr = example();
  
  // now I know that $arr contains $arr['firstStringName'];
  </code></pre>
  
  <p>I need to find out the index of <code>$arr['firstStringName']</code> so that I am able to loop through <code>array_keys($arr)</code> and return the key string <code>'firstStringName'</code> by its index. How can I do that?</p>