|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-09 13:01 UTC] helly@php.net
[2004-05-09 13:02 UTC] helly@php.net
[2004-07-01 06:35 UTC] curt@php.net
[2004-07-02 05:05 UTC] curt@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 19:00:01 2025 UTC |
Description: ------------ I've a function __autoload in my script. I want to use class_exists to determine if a class definition has been included but i don't want to load it. However, class_exists call __autoload systematically when a class definition hasn't been loaded. This problem poses problems of compatibility with previous versions. Indeed, many scripts used this function before using a include. Reproduce code: --------------- function __autoload($classname) { echo 'i want to load ['.$classname.']<br>'; } class A {} if (class_exists('B') == false) echo "Class B don't exist !<br>"; else echo "Class B exist !<br>"; if (class_exists('A') == false) echo "Class A don't exist !<br>"; else echo "Class A exist !<br>"; Expected result: ---------------- Class B don't exist ! Class A exist ! Actual result: -------------- i want to load [B] Class B don't exist ! Class A exist !