Tested: {code...} reply content:
See the PHP document: empty-check whether a variable is empty
Obviously, obj is not empty ~
Test:
Print_r ($ obj );
Game Object ()
Empty or non-empty are defined. don't guess ......
The object has been instantiated.Empty
It is certainly not empty, I understandEmpty
Empty (''); // trueempty (0); // trueempty ('0'); // trueempty (NULL); // trueempty ([]); // trueempty (array (); // false $ a; // only defines empty ($ a) without assigning values ); // trueclass AA {}$ aa = new AA (); empty ($ aa); // false: the object actually exists. it is not empty. class BB {public $ name ;} $ bb = new BB (); empty ($ bb-> name); // true
This is obviously not empty. empty is generally used to judge Variables. In fact, it does not actually work to judge an object,
You create an empty object, which is different from assigning an empty variable or an empty array,
Or you can print it out and see, object (Game) [1]
This is printed,
The above is the php empty. will true be returned for objects without attributes? For more information, see The PHP Chinese website (www.php1.cn )!