Consider the following:
class MyClass { private $var1 = \"apple\"; private $var2 = \"orange\"; } $obj = new MyClass(); if($obj) { // do this } else
You can do it like that : (bool) $yourObject
will