Display the drop-down list

call_user_func()

« cal_to_jd | call_user_func_array »
<?php
// 
function barber($type)       { return "You wanted a $type haircut, no problem"; };
// function foobar($arg$arg2) { return __FUNCTION__ " got $arg and $arg2"; };

// adds custom callback functions, closures and methods
require "pbx_callbacks.php";
class_alias("pbx_callbacks""myclass");
$object = new myclass();

$mixed call_user_func (
    
?// callable $callback
    
// [mixed $parameter1]
    
// [mixed $parameter2]
    
  // [mixed $parameter3]
);
?>
Result
$mixed = 'You wanted a shave haircut, no problem'
Examples
#1 call_user_func  ("barber",
 
"mushroom")
#2 call_user_func  ($barber,
 
"shave")
#3 call_user_func  ([=> "myclass"=> "say_hello"])
#4 call_user_func  ("myclass::say_hello")
#5 call_user_func  ([=> $object=> "say_goodbye"],
 
"Bob")
#6 call_user_func  ("foobar",
 
"one",
 
"two")
#7 call_user_func  ("strncmp",
 
"abc",
 
"DEF",
 
3)
#8 call_user_func  ($xyz,
 
"mushroom")
#9 call_user_func  ([=> "xyz"=> "say_hello"])
#10 call_user_func  ([=> "Closure"=> "bind"])
#11 call_user_func  ("myclass::xyz")
#12 call_user_func  ([=> $xyz=> "say_goodbye"],
 
"Bob")
#13 call_user_func  ([=> $xyz],
 
"Bob")
#14 call_user_func  ([=> $object=> "say_goodbye"],
 
"Bob")
#15 call_user_func  ($xyz,
 
"one",
 
"two")
#16 call_user_func  ("xyz",
 
"abc",
 
"DEF",
 
3)
See also
call_user_func_array, class_alias, is_callable, pbx_callbacks