Skip to content

Instantly share code, notes, and snippets.

@sagarppanchal
Created January 27, 2018 17:46
Show Gist options
  • Select an option

  • Save sagarppanchal/5650036897cb3daf0eee511145b2790a to your computer and use it in GitHub Desktop.

Select an option

Save sagarppanchal/5650036897cb3daf0eee511145b2790a to your computer and use it in GitHub Desktop.
Search Value from multidimensional array
class commonuse
{
/* common class for multiple uses */
/* search_multidemsional @sagar : 20072016 */
/*
$value="abc";
$array=array("car"=>array("modules"=>array("engine"=>array("power"=>"40hpwrs"))));
*/
public function search_multidemsional($value, $array, $key) {
foreach ($array as $k => $val) {
if ($val[$key] === $value) {
return $k;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment