Why the name
constant is not recognised in the static function f2()
?
class Foo {
protected static function f1($s) {
echo "doing $s";
}
}
class Bar extends Foo {
const name = 'leo';
public static function f2() {
Foo::f1(name);
}
}
$bar = new Bar();
$bar->f2();
I get the following error:
Notice: Use of undefined constant name - assumed 'name' in ...
What am I doing wrong ?