Re: Calling Functions without all the arguments

From: Date: Fri, 13 Apr 2001 14:46:21 +0000
Subject: Re: Calling Functions without all the arguments
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48449@lists.php.net to get a copy of this message
On Fri, 13 Apr 2001, Hardy Merrill wrote: >I found the same problem - when we upgraded to PHP4, function calls >that used to work and NOT provide all the parameters, started failing. > >The way I fixed it was to give each parameter a default value *IN* >the function definition, like: > >function abc($a='', $b='') // assigns null as parameter defaults > >that way, every parameter gets a value, even if all the parameters >were not supplied in the call. > This works great (thanks for that :). However my question now is, what is the general opinion about how to handle this. Is it better to call functions giving all arguments values (even if its an empty "" value) or is it fine to assign values from within the function as described above ? Chris

« previous php.general (#48449) next »