note 21919 added to function.array-key-exists
| From: | php dot steph at e-bonnell dot net | Date: | Fri, 31 May 2002 07:31:20 +0000 |
| Subject: | note 21919 added to function.array-key-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31262@lists.php.net to get a copy of this message | ||
This workaround is not working if the array is not defined. The original function in PHP 4.1 is.
This version seems to be OK :
if (phpversion() < '4.1') {
eval('function array_key_exists($key, $arr)
{
if (!is_array($arr))
return false;
foreach (array_keys($arr) as $k)
if ($k == $key)
return true;
return false;
}');
}
--
http://www.php.net/manual/en/function.array-key-exists.php
http://master.php.net/manage/user-notes.php?action=edit+21919
http://master.php.net/manage/user-notes.php?action=delete+21919
http://master.php.net/manage/user-notes.php?action=reject+21919