|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-03-03 06:02 UTC] phanto@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
When we return NULL from the constructor, our intend is to tell caller that NO OBJECT IS CREATED. But in PHP this case does not work. Please check the following example; <?php class Test{ var $myVar; function Test($val){ if (is_null($val)) return NULL; else $this->myVar = $val; return $this; } } $a = NULL; $t = new Test($a); if (is_object($t)) echo "Although it must be NULL, it says OBJECT"; ?> I am developing a very huge API using PHP and this does not permit us to continue. I think, there should be a way of doing this in a language which support OOP constructs. Sincerely, Ziya Karakaya