note 94441 deleted from language.oop5.autoload by crell

From: Date: Mon, 04 Apr 2022 16:12:43 +0000
Subject: note 94441 deleted from language.oop5.autoload by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218033@lists.php.net to get a copy of this message
Note Submitter: khan at swcombine dot com ---- As an addendum to #91119 I would suggest adding class_exists() into that solution. I've just implemented autoloading based on the code provided there and ran into a problem where a file had the same name as a class, existed in the directory structure prior to the file that had the actual class and as a result was being included first and resulting in a 'class not found' error. <?php if(file_exists($path)) { require_once $path; if(class_exists($class_name)) { return; } } ?>

« previous php.notes (#218033) next »