This tutorial will show you some important functions that can be used to work with your own written PHP functions.
Calls the function “func” with the given argument “arg”.
It will return 2-1 and the second call of call_use_func may be used only with PHP 5.3+ and is a more advanced way to use it. The output would be ‘Tutorial php’.
The first function is defined normally and in $array_p we are storing the number 7 and 8, their sum will be 7.
The second function is stored in $func2 variable. The result will be 12.
Creates a function that has the “arguments” and the “function code”; it returns the function or FALSE.
In $var we are creating the function which takes one argument: $arg and the code: return $arg * 2, so the result of the call will be 8.
Returns the number of the arguments which are taken by the function. It is used inside the function.
The number of arguments is 3.
Returns an array with the arguments received by the function. It is used inside that function.
register_shutdown_function(“func”, param1, param2 …)
Makes “func” to run after the script is executed or if exit() is called. param1, param2 … are optional and will be attached to the function.
For more information please visit: PHP.net
That’s it! I hope you enjoy reading this PHP tutorial.
Leave a Reply