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
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
No. But you can throw an exception in the __construct() method, and handle that.