Page 1 of 1

variable number of method arguments: indication practice

Posted: Thu Aug 28, 2008 12:51 pm
by koen.h
A certain method or function has a variable number of arguments. What is a good practice to code this so code hinting will be clear for everyone?

example:
setVars($fixedVar, $optionalVar1 = null, $optionalVar2 = null)

This will make it clear, I think, how I'm expecting the arguments are given.

Re: variable number of method arguments: indication practice

Posted: Thu Aug 28, 2008 3:59 pm
by Chalks
I generally just put a comment above the function saying "here's what you can do with this: [explain]".