You are here: empty function and array indices « PHP « IT news, forums, messages
empty function and array indices

Posted by Gabriel Birke on 05/01/05 23:47

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация