Welcome Guest, Not a member yet? Register   Sign In
variable function argument amount
#1

[eluser]plainas[/eluser]
I would like to have a function that would accept sometimes one argument sometimes two.
But whenever i call it with only one argument it throws a php error.

Basically I want both of this to be possible:

mysite.com/index.php/controller/function/arg

mysite.com/index.php/controller/function/arg/another_arg

EDIT: ok, that problem is easily solvable by assigning a default value to optional parameters.
Mods please delete this topic


Messages In This Thread
variable function argument amount - by El Forum - 12-29-2007, 08:04 PM
variable function argument amount - by El Forum - 12-30-2007, 12:13 AM
variable function argument amount - by El Forum - 12-30-2007, 12:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB