mixed func_get_arg ( integer $argument_index );
The PHP construct
func_get_arg returns the specified argument that was passed to the function, regardless if it was declared in the function’s parameter list or not. Remember that you can pass more arguments to a function than are specified (declared) in the function’s parameter list.
- The index number of the argument you want to get. The index starts at zero, which is the first argument passed to the function.
It returns the specified argument. If an error occurs, then
FALSE is returned.
Errors and Exceptions
You will get a warning in the following conditions:
- You use it outside of a function.
$argument_indexyou specify is less than zero or greater than the number of arguments passed to the function.
Show It in ActionBasic
Let’s see the
func_get_arg function in action. In this video, you will see how it works.
Hands off the keyboard. Web development starts by thinking first, then planning it out, and then coding it.
In this video, you will go deeper into the instruction.