I just have found out that there is a function called func_get_arg in PHP which enables developer to use variant style of getting arguments.
It seems to be very useful because number of argument can now be arbitrary, but I cannot think of any good example of using it.
What are the some examples of using this function to fully benefit its polymorphic characteristic?
I usually use
func_get_args()which is easier to use if wanting multiple arguments.For example, to recreate PHP’s
max().CodePad.
Now you can do
echo max(1,5,7,3)and get7.