Created
January 15, 2013 22:33
-
-
Save andrijeski/4542806 to your computer and use it in GitHub Desktop.
This file contains 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
C:\Users\Sasho>howdoi php check value in an array | |
Nothing will be faster than a simple loop. You can mix-and-match some array functions to do it, but they'll ju | |
st be implemented as a loop too. | |
function whatever($array, $key, $val) { | |
foreach ($array as $item) | |
if (isset($item[$key]) && $item[$key] == $val) | |
return true; | |
return false; | |
} | |
http://stackoverflow.com/questions/6990855/php-check-if-value-and-key-exist-in-multidimensional-array (1/5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment