I am confused now and then while editing my recent project. This is about 'default arguments'.
I have here a function similar to what i have posted last time, only different now.
Code: Select all
function foo($name='no name',$address='no address',$age=0){Code: Select all
// full arguments
foo('Harrison','Philippines',23);
// no age
foo('Harrison','Philippines');
// name only
foo('Harrison');
// etc...Code: Select all
foo('','',23);
// or using constants
foo(NO_NAME,NO_ADDRESS,23);And if a don't define argument and let the 'func_num_args()' do the job, How can I know if I what I passed is the name or the address argument assuming that they have the same data type?
I want to give a value for the third argument and default values for the first two arguments.
How can I make this happen? Any Ideas?...