php 5 bug?

php.internals

Nuno Lopes

22 years ago
Hello, I don't know if this is a bug or a feature, but... The code below works with PHP 4, but gives an error in PHP 5. Nuno -------------------------------- <?php $test = new test(); $test->func(); class test { function func() { echo 'test'; } } ?> ------------------- PHP 4: test ------------------- PHP 5: Fatal error: Class 'test' not found in C:\...\bug.php on line 2

Christian Schneider

22 years ago
Nuno Lopes wrote:
> I don't know if this is a bug or a feature, but... The code below works with > PHP 4, but gives an error in PHP 5.
Classes have to be defined before they are used in PHP5. - Chris