<?php
// Global function
$a = 'max';
echo call_user_func($a, 1, 2);
echo $a(1, 2);
// Class method
class A {
public function b() {
return __CLASS__;
}
static function c() {
return 'I am static!';
}
}
$a = new A;
$b = 'b';
echo call_user_func(array($a, $b));
echo $a->$b();
// Static class method
$c = 'c';
echo call_user_func(array('A', $c)); // I am static!
echo a::$c();