<?php
class T {
public function x(){
return true;
}
}
var_dump(T::x());
class X {
public function x(){
return true;
}
}
var_dump(X::x());
このコードの結果は次のとおりです。
bool(true)
PHP Fatal error: Non-static method X::x() cannot be called statically in test.php on line 16
T::x() が機能し (失敗するはずなのに)、X::x() が失敗するのはなぜですか?