In PHP 4, if you use a class before it's defined you get this error:
Fatal error: Undefined class name 'foo' in...
My code is:
function do_stuff(){
if(foo::what()) ... // this code is before the php file with the foo class is included
}
class foo{
function what(){
...
}
}
do_stuff();
is there any workaround for this (besides telling the people who use your script to update to php5) ?
You could instead use:
which would cause the class/method to be checked at runtime rather than compile time.