I\'m reading JSON data with PHP and that data contains empty objects (like {}
). So the problem is, I have to handle the case when object is empty in different m
Try without using empty()
which is:
get_object_vars($obj) ? TRUE : FALSE;
On PHP docs we can read the note:
When using
empty()
on inaccessible object properties, the__isset()
overloading method will be called, if declared.
Which means when using empty()
on an object which is having __get()
method, it will always return True.