I also just discovered how to check for these keys with no value as isset() will 
return false:

<?php

   $arr = array("foo" => "bar");
   
   $arr["foo"] = NULL;
   
   print_r($arr); // you can see "foo" is still there
     
   if (array_key_exists("foo", $arr))
   {
      echo("it's there!");
   }
   
?>
   
 bvr.

==================BEGIN FORWARDED MESSAGE==================

Yes, I read that one on this list and it reminded me 
of a problem where i used $Arr['cyanide'] = NULL;
because the key was still defined after this.

never figured unset() would do the trick because I 
always did = NULL.

bvr.

On Wed, 16 Jan 2002 17:45:21 -0500, Erik Price wrote:

>This is a good one I just learned last week -- unset the variable.  That 
>is,
>
>unset($Arr[2]);
>
>or
>
>unset($Arr['cyanide']);
>
>from what I understand, the discovery of this easy way to do this was 
>accidental.  See the second annotation of "array_splice()" in the PHP 
>manual here for the details:  
>http://www.php.net/manual/en/function.array-splice.php




===================END FORWARDED MESSAGE===================




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to