title: Find index of value in associative array in php?
body: <p>If you have any array $p that you populated in a loop like so:</p>
  
  <pre><code>$p[] = array( "id"=&gt;$id, "Name"=&gt;$name);
  </code></pre>
  
  <p>What's the fastest way to search for John in the Name key, and if found, return the $p index? Is there a way other than looping through $p? </p>
  
  <p>I have up to 5000 names to find in $p, and $p can also potentially contain 5000 rows. Currently I loop through $p looking for each name, and if found, parse it (and add it to another array), splice the row out of $p, and break 1, ready to start searching for the next of the 5000 names.</p>
  
  <p>I was wondering if there if a faster way to get the index rather than looping through $p eg an isset type way?</p>
  
  <p>Thanks for taking a look guys.</p>