tags:

views:

51

answers:

1

Is it at all possible to have a class return false instead of an object reference? It would make error handling very clean. Consider the code:

$page = new PageContent('www.google.com');
if ($page)
  // do stuff
else
  // handle error
+4  A: 

No. But you can throw an exception in the __construct() method, and handle that.

Ben James
I agree. Use Exceptions for this. They are designed for it :).
TheGrandWazoo