note 83612 deleted from language.oop5.autoload by felipe

From: Date: Wed, 04 Jun 2008 14:41:47 +0000
Subject: note 83612 deleted from language.oop5.autoload by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140117@lists.php.net to get a copy of this message
Note Submitter: mohannad shubita ---- hi...i have this question : i need to clear some points about the function __autoload : IS THIS CORRECT : in the beginning of the script we write : function __autoload($class_name) { require($class_name.'.php'); } then for ex : $obj = new class1; apache will first search for a defined class in the script with the name class1..if not found it will load a file called class1.php in the same dir the script exists... i add this : function __autoload($class_name) { if(is_file($class_name.'.php')) include it else echo "cant find file!"; } then when i tried to create a new object : $obj = new class1; and deleted the file class1.php it prints : can find file then fatal error :class 'class1' not found.. it is suppose to only print : cant find file thanks

« previous php.notes (#140117) next »