note 67995 added to function.array-key-exists

From: Date: Sun, 09 Jul 2006 10:25:21 +0000
Subject: note 67995 added to function.array-key-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-114606@lists.php.net to get a copy of this message
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! ---- Server IP: 216.194.113.175 Probable Submitter: 67.150.118.16 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php Edit -- http://master.php.net/note/edit/67995 Del: integrated -- http://master.php.net/note/delete/67995/integrated Del: useless -- http://master.php.net/note/delete/67995/useless Del: bad code -- http://master.php.net/note/delete/67995/bad+code Del: spam -- http://master.php.net/note/delete/67995/spam Del: non-english -- http://master.php.net/note/delete/67995/non-english Del: in docs -- http://master.php.net/note/delete/67995/in+docs Del: other reasons-- http://master.php.net/note/delete/67995 Reject -- http://master.php.net/note/reject/67995 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#114606) next »