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.
Break. Go rest your noodle for a couple of minutes.
In this video, you will go deeper into the instruction.