|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-28 11:11 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
Description: ------------ There is written in the manual that empty($object) == TRUE, where $object has empty properties. >> empty() returns FALSE if var has a non-empty or non-zero value. In otherwords, "", 0, "0", NULL, FALSE, array(), var $var;, and objects with empty properties, are all considered empty. TRUE is returned if var is empty. << But IMHO there is an error if $object is instance of class A {}. I think the A's instance has no properties hence it is an "object with empty properties". So why empty($a) == FALSE where $a = new A? It seems that empty() does never return TRUE. BTW: What does "var $var;" mean? Reproduce code: --------------- class A {} $a = new A; var_dump(empty($a)); Expected result: ---------------- bool(true) Actual result: -------------- bool(false)