Re: [PHP] empty function and array indices

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 1:47 pm, Gabriel Birke said: > Is empty() some kind of special function where the validity > of indices is not checked? Bingo! That's rather the whole point of empty and isset. :-) The behaviour of empty has changed over time, with various releases. isset seems more "stable"

Re: [PHP] empty function and array indices

2005-05-01 Thread Mark Cain
>From the Manual: empty() is the opposite of (boolean) var, except that no warning is generated when the variable is not set It appears that there is a revamp of what is considered to be empty in PHP 5. http://php.net/empty You might be better served with array_key_exists() such as: echo arra

Re: [PHP] empty function and array indices

2005-05-01 Thread Rasmus Lerdorf
Gabriel Birke wrote: Hello! Suppose I have the following code: $a = array('a'=>1, 'b'=>2); echo empty($a['c'])?'empty':'not empty'; echo $a['c']; Why doesn't the 2nd line output a warning when error_reporting is set to E_ALL? Is empty() some kind of special function where the validity of indices is