note 67995 deleted from function.array-key-exists by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 20:53:43 +0000 |
| Subject: | note 67995 deleted from function.array-key-exists by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134543@lists.php.net to get a copy of this message | ||
Note Submitter: ncurtis at cenicola-helvin dot com
----
array_key_exists() does not check values in the key i wrote this function to check if a key in an
array has a empty value as corresponds to values that return true for empty() an redirects to a page
if specified otherwise returns false
<?php
function keysExists($array, $startingIndex, $redirectPage) {
if(is_array($array)) {
if (!empty($startingIndex)) {
for ($i = 0; $i < $startingIndex; $i++) {
next($array);
}
}
while(list($key, $value) = each($array)) {
if (empty($value)) {
if (!empty($redirectPage)) {
header("Location: $redirectPage");
} else {
return FALSE;
}
}
}
} else {
return FALSE;
}
}
?>
email me and let me no if you found this useful!