note 61388 deleted from language.oop by danbrown

From: Date: Sat, 07 Nov 2009 19:03:06 +0000
Subject: note 61388 deleted from language.oop by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162557@lists.php.net to get a copy of this message
Note Submitter: Wolverine ---- In case you would like to interrupt object construction on some condition and return false for further checking: <?php class Foo { // Constructor function Foo() { /* Some inits here */ $someval=false; if ($someval===false) { return false; } } } $obj=new Foo(); // This won't work and will return partially initialised object instead of false class Bar { // Constructor function Bar() { /* Some inits here */ $someval=false; if ($someval===false) { $this=false; return; } } } $obj2=new Bar(); // This will work as expected and return false ?> Hope this helps some people.

« previous php.notes (#162557) next »