public
Created

Arr::keys_exists($keys, $array)

  • Download Gist
gistfile1.aw
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?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;
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.