How to check that an object is empty in PHP?

You can cast to an array and then check if it is empty or not

$arr = (array)$obj;
if (!$arr) {
    // do stuff
}

Leave a Comment