Created
January 27, 2018 17:46
-
-
Save sagarppanchal/5650036897cb3daf0eee511145b2790a to your computer and use it in GitHub Desktop.
Search Value from multidimensional array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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