Re: php/mysql object id question..

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

 



bruce wrote:
in their constructor, they have the 'return false' arrggghh!!! a quick look
at google, and it appears that you can't return any val from a constructor.
in fact, the 'object id' that's being returned appears to simply be (as you
stated) the instance of the class that was created... as opposed to a return
val...

If you want to stop the object from being created for any reason (e.g. connection to database failed) and you're using PHP 5, I believe that you can throw an exception in the constructor.

From http://php.net/language.oop5.basic :

"An object will always be assigned when creating a new object unless the object has a constructor defined that throws an exception on error."

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
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