//
empty($var);
if($var){echo ""}
but an object variable fails to use the above method, is there any good way?
to supplement the application scenarios, we can temporarily think of the following two common situations:
1,
2 when the result set returned by the query database is in the form of an object, and a json string is converted into an object
. Of course, both cases can be converted into an array, so it is easy to determine whether the array is empty, but the array is not as written as the object, especially the array converted by the json string. There are often cases where the dimension is relatively large. When you want to access an item in it, you have to write a bunch of parentheses. Where is the object access property written? is that right?