PHP 5 Usage: Possible Bug?

From: Date: Thu, 31 Jul 2003 04:45:53 +0000
Subject: PHP 5 Usage: Possible Bug?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157663@lists.php.net to get a copy of this message
All, I came across the following inconsistency between PHP 4 and PHP 5 Build 2195(Jul 24 2003 20:10:21). The error makes sense. I am just curious about the version inconsistency. Is this due to a change in PHP 5 (as part of the class enhancements) or is it an oversight? For my information, please advise. ==Example== I can initiate a class before it is defined in version 4, but not in 5. <? //filename.php //you can initiate the class before it is defined $page = new PageClass; class PageClass{ blah...blah...blah...; } ?> will work in PHP 4, but will generate an 'Underfine Class' error in PHP 5. In PHP 5, the above must be written as <? //class must be defined first class ClassName { blah...blah...; } //class must be defined before it is initiated $page = new ClassName; ?> This error makes sense, as you cannot use something that doesn't exist. I'm mostly curious about the inconsistency between the two versions. This is not a big issue, but I am curious? Any comments? -john

« previous php.general (#157663) next »