|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2002-12-11 06:05 UTC] sniper@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 09:00:01 2025 UTC | 
take the following example: <?php class MethodsOnly { //var $dummy; function doSomething() { print("OBJ: doing something\n"); } }// class $OBJ = new MethodsOnly(); $OBJ->doSomething(); print("empty(OBJ): ".(empty($OBJ) ? "true" : "false")."\n"); print("OBJ == null: ".(($OBJ == null) ? "true" : "false")."\n"); print("OBJ === null: ".(($OBJ === null) ? "true" : "false")."\n"); ?> it gives the following output: OBJ: doing something empty(OBJ): true OBJ == null: true OBJ === null: false now, if you uncomment the $dummy member variable: OBJ: doing something empty(OBJ): false OBJ == null: false OBJ === null: false Sure, one should/could use "static calls" - like MethodsOnly::doSomething() - in this case (class without member vars), but we discovered this when migrating a project from PHP3 to PHP4 .. and, anyway, shouldn't an existing object behave the same wether it has member variables or not? ;)