note 67995 deleted from function.array-key-exists by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.