Created
October 8, 2011 17:01
-
-
Save daGrevis/1272557 to your computer and use it in GitHub Desktop.
Arr::keys_exists($keys, $array)
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
<?php | |
class Arr extends Kohana_Arr { | |
/** | |
* Checks that keys exists in the array. | |
* Keys, not key (singular), as built-in function does. | |
* | |
* @param array The array of keys | |
* @param array The array to check | |
* @return boolean Does all keys exists in the array? | |
*/ | |
static function keys_exists(array $keys, array $array) { | |
foreach ($keys as $key) { | |
if (array_key_exists($key, $array) === false) { | |
return false; | |
} | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment