Roan Kattouw wrote:
tstarling@svn.wikimedia.org schreef:
Revision: 40902 Author: tstarling Date: 2008-09-16 06:13:31 +0000 (Tue, 16 Sep 2008)
Log Message:
Fixed documentation. Don't use empty() to determine if an array has zero length, that's not what it does.
That's exactly what it does [1].
Roan Kattouw (Catrope)
No, it does the same thing as the "!" operator, except it also suppresses warnings. If you want to check if an array has zero length, you should just use "!", as I did in that commit, so that a typo in the variable name will still give you the appropriate warning. Or if you want to make it explicit that you are checking array length, you can use !count($array). empty() should only be used when you are sure you want to ignore warnings.
-- Tim Starling