Personally, I would strongly prefer the caller syntax my_func('a', 'b', 'c' => 'd', $e => $f) just to because

        1) it's consistent with array declaration syntax
2) it allows arbitrary names for parameters, which will become the array keys ... and can include funny characters 3) naked identifiers in PHP are used only for functions, classes and constants, so c => 'd' looks like a constant 4) it allows the flexibility of dynamically specifying parameter names, although this will probably be rarely needed

My second favorite is my_func('a', 'b', c => 'd') ... which I consider worse but at least not as bad as my_func('a', 'b', c: 'd') ... which seems to come out of left field as it's not consistent with the rest of PHP syntax. Unless, of course, c: 'd' is going to be a shorthand for 'c' => 'd' ... which makes me ask ... if you guys are ever going to make a short array declaration syntax, will it look something like this: {'a'=>'b', 'c'=>'d'} or will it look like {a: 'b', c: 'd'} ?

Anyway, my 2c.
Greg

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to