[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    [PHP] empty function and array indices
From:       Gabriel Birke <gabriel.birke () gmail ! com>
Date:       2005-05-01 20:47:45
Message-ID: 32903d4e05050113474ef4595c () mail ! gmail ! com
[Download RAW message or body]

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 not checked? If that is the case, I have two questions:

1. Will this behavior persist in future versions of PHP?
2. Are there other functions or a general rule where PHP doesn't
output warnings when a nonexistant index is given?

-- 
Immanuel doesn't pun, he Kant.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic