Bu mükemmel Tamam - ama statik olmayan yöntem denilir hangi nesne üzerinde göstermek için, kendi sınıfının bir örneğinin bir nesne geçmek zorunda unutmayın:
class MyClass {
public function hello() {
echo "Hello, World!";
}
}
$a = new MyClass();
call_user_func(array($a, 'hello'));
You should not use something like this :
call_user_func('MyClass::hello');
Size aşağıdaki uyarıyı verecektir:
Strict standards: `call_user_func()` expects parameter 1 to be a valid callback,
non-static method `MyClass::hello()` should not be called statically
(This would work perfectly fine if the method was declared as static... but it's not, here)
For more informations, you can take a look at the callback section of the manual, which states, amongst other things (quoting) :
A method of an instantiated object is
passed as an array containing an
object at index 0 and the method name
at index 1.
If you get a strict error with PHP 5.2 and not with PHP 5.3, it's probably a matter of configuration -- I'm thinking about the error_reporting directive.
Not E_ALL içerir E_STRICT (quoting) em> değildir:
E_ALL : All errors and warnings, as
supported, except of level E_STRICT.