Array_empty
Auteur: nick5556 - 16 april 2010 - 12:33 - Gekeurd door: Ibrahim - Hits: 3184 - Aantal punten: (0 stemmen)
Dit script controleerd of een van de sleutels in de array leeg is.
Special thanks to: Ibrahim.
|
Code: |
/*
* @version: 1.0
* @author: Nick Smit <nick.smit@quicknet.nl>
* @thanks: Ibrahim Abdullah
* @param: array $array The array to check
* @param: boolean $useKey[optional] false for only value array, true for key-value array, default value is false
* @return: true if no empty values found, false if empty falue is found
*/
function empty_array($array, $useKey = false) {
if(is_array($array)) {
foreach($array as $key => $value) {
$val = ($useKey ? $key : $value);
if(empty($val)) {
return true;
}
}
} else {
return true;
}
return false;
}
/* * @version: 1.0 * @author: Nick Smit <nick.smit@quicknet.nl> * @thanks: Ibrahim Abdullah * @param: array $array The array to check * @param: boolean $useKey[optional] false for only value array, true for key-value array, default value is false * @return: true if no empty values found, false if empty falue is found */ function empty_array($array, $useKey = false) { foreach($array as $key => $value) { $val = ($useKey ? $key : $value); return true; } } } else { return true; } return false; }
Download code (.txt)
|
|
Stemmen |
Niet ingelogd. |
|