Interrupting instantiation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In PHP4, is there any way to interrupt instantiation of an
object?  For example, by returning NULL as the return
value of the class constructor so that the variable you are
assinging the object to is, instead, null?

Here's what I'm trying to do:

class MyClass {
  function MyClass() {
    return NULL;
  }
}
$myVar = new MyClass();
echo 'IsObject? [' . is_object( $myVar ) . ']<br>';

I would expect $myVar to be a NULL value.  Or at least,
not an object of MyClass.  But it is an object of MyClass.
So is there any way to interrupt the instantiation?  So that,
if there is an error during the execution of the constructor,
an object isn't returned?

thnx,
Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux