Reference PHP documentation: empty - Check whether a variable is empty
Obviously obj is not empty~
Test it:
1 |
|
Game Object ( )
empty Or non-empty is defined, don’t guess...
objects have been instantiated, then empty
will definitely not be empty. I understand empty
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
This is obvious It’s not empty. Empty is generally used to judge variables. In fact, it has no practical effect when you judge an object.
New an empty object is different from assigning an empty variable or an empty array.
Or you can print it out. Take a look, object(Game)[1]
This is what is printed,
The above is php empty. Isn’t it an object without attributes that will return true? For more related content, please pay attention to the PHP Chinese website (www.php.cn)!