Share on Google+Share on Google+

PHP Array get key from value

This section illustrates how to get the key from the array for the given value

  • In php array one can get the key from value by the use of array_search function
  • Array_search function searches the key for the given values in the array.

Example of PHP Array Get Key from Value
=array("n"=>"newyork","c"=>"cylone","t"=>"tokyo","New Delhi","d"=>"dhaka");
"key of cylone is ".$k;

key of cylone is c


Posted on: October 28, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.