PHP call_user_func on a static method PHP call_user_func on a static method php php

PHP call_user_func on a static method


You're missing the namespace:

$class = '\\MyBundleNamespace\\MyClass';$method = 'myFunction';

Both calls should work:

call_user_func("$class::$method");call_user_func(array($class, $method));