/ Published in: PHP
Function to check existence of value in multidimensional array.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
"fruit" => "orange", "id" => 4 ), "test" => "test1", "id" => 152 ), "test" => "test2", "id" => 152 ) ); function search_in_array($value, $array) { return true; } foreach($array as $item) { return true; } return false; } $so = (search_in_array('orange',$array)) ? 'nothing' : 'daa'; echo $so;