Global class

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Global class
Groups: php.general 
Request: Send a blank email to php-general+get-3518@lists.php.net to get a copy of this message
Hi, can anyone tell me why this isn't working properly? global.php3 <? $error = new Error; /* A class */ function setError() { global $error; } ?> <? include("global.php3"); setError(); function testcode() { $error->addError("Test1","1"); $error->addError("Test2","2"); $error->viewError("1"); } ?> <? class Error() { function addError($mes,$val) { echo $mes; } function viewError($val) { echo $val' } } ?> PHP give the following warnings Warning: Object error not found in Object.php3 on line 28 Fatal error: Member function used on a non-object in Object.php3 on line 28 with regards, Tijmen Hennink

« previous php.general (#3518) next »