call_user_func

PHP 4, PHP 5, PHP 7, PHP 8
call_user_func - Call the callback given by the first parameter
Manual
Code Examples

Example #1 call_user_func example

Result: You wanted a mushroom haircut, no problem You wanted a shave haircut, no problem
PHP Version:

Example #2 call_user_func using namespace name

Result: Hello world! Hello world!
PHP Version:

Example #3 Using a class method with call_user_func

Result: Hello! Hello! Hello!
PHP Version:

Example #4 Using lambda function with call_user_func

Result: [test]
PHP Version:


Function call_user_func:

Function Handling Functions

Most used PHP functions