Why can’t you just use
if(isset($content->images)) //Isset also will make sure $content is set
{
}
This way your performing checks on both entities.
As images is an object that can be iterated you can also check that.
if(isset($content->images) && is_object($content->images))
{
}
Also you seem to be using the wrong comparison operators for boolean’s, you should be using the strict standards for comparison, which is ===, and not ==, or !==, and not !=🙂