Re: consistent way to handle structs
| From: | Hartmut Holzgraefe | Date: | Fri, 11 Jan 2002 12:33:26 +0000 |
| Subject: | Re: consistent way to handle structs | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76635@lists.php.net to get a copy of this message | ||
derick@php.net wrote
just that a feature may be misused can't be a reason against it IMHOI cannot read code that looks like fn(,,,,foo,,,,bar);, that is just a parameter-guessing-game!
Of course, that looks likes crap, but one parameter not specified is not a problem IMO.especialy if you could give the middle parameter a default value right now you end up with <?php function foo($bar, $opt1, $opt2) { if($opt1==NULL) $opt1="default1"; if($opt2==NULL) $opt2="default2"; echo "foo($bar, $opt1, $opt2)\n"; } foo(1,null,2); foo(1,2,null) ?> i think the following would be an improvement here: <?php function foo($bar, $opt1="default1", $opt2="default2") { echo "foo($bar, $opt1, $opt2)\n"; } foo(1,,2); foo(1,2); ?> -- Hartmut Holzgraefe hartmut@six.de http://www.six.de +49-711-99091-77