<?php
function foobar($arg, $arg2) {
echo __FUNCTION__, " got $arg and $arg2\n";
}
class foo {
function bar($arg, $arg2) {
echo __METHOD__, " got $arg and $arg2\n";
}
}
// foobar() işlevini iki bağımsız değişken ile çağıralım
call_user_func_array("foobar", array("one", "two"));
// $foo->bar() yöntemini iki bağımsız değişken ile çağıralım
$foo = new foo;
call_user_func_array(array($foo, "bar"), array("three", "four"));
?>
Yukarıdaki örnek şuna benzer bir çıktı üretir:
foobar got one and two
foo::bar got three and four