String
PHP String Function
func_get_args():
array
Returns an array comprising a function’s argument list
function MyFunction() {
$function_arguments = func_get_args();
print_r($function_arguments);
}
MyFunction('a', 'b', 'c', 1, 2, 3);
// Array
// (
// [0] => a
// [1] => b
// [2] => c
// [3] => 1
// [4] => 2
// [5] => 3
// )
func_get_arg(
int $position
):mixed
Return an item from the argument list
function MyFunction() {
$function_argument = func_get_arg(0);
print_r($function_argument); // a
}
MyFunction('a', 'b', 'c', 1, 2, 3); // a
func_num_args():
int
Returns the number
of arguments passed to the function
function MyFunction() {
$function_arguments_nums = func_num_args();
var_dump($function_arguments_nums); // 6
}
MyFunction('a', 'b', 'c', 1, 2, 3);
call_user_func(
callable $callback
,mixed ...$args
):mixed
Call the callback given by the first parameter
function MyFunction(string $name, int $age) {
print_r($name); // KJ
print_r($age); // 18
}
call_user_func('MyFunction', 'KJ', 18);
call_user_func_array(
callable $callback
,array $args
):mixed
function MyFunction(string $name, int $age) {
print_r($name); // KJ
print_r($age); // 18
}
call_user_func_array('MyFunction', ['KJ', 18]);
PHP String Function
PHP Array Function
PHP Math Function
PHP Filter Function
PHP Class Function
PHP Sort Function
PHP File Function
PHP Time Function
PHP Variable Handling Function
PHP Http Function
PHP System Function
PHP Generator Function