Re: simpler syntax for arrays

From: Date: Thu, 18 Dec 2008 11:57:54 +0000
Subject: Re: simpler syntax for arrays
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-42326@lists.php.net to get a copy of this message
Jay I. wrote: > interesting idea, thanks. but unfortunately it won't help me as i really > need to pass arrays as a single argument like this: > > my_func($param_1,$param_2,array(...)); You can do that. All parameters in a row with => will be merged to one array. You could call myfunc($a, $b, 'foo' => "bar", 'qux' => "quux"); with our patch You can free mix arrays and scalar values like myfunc($a, 'b' => "foo", $c, 'd' => "bar", ...); which is the same as myfunc($a, array('b' => "foo"), $c, array('d' => "foo"), ...); And if you need two separate arrays in a row you can still go back to having array() for the second one (but we avoid parameter lists like that). Ok, enough plugging of that syntax on the list, further replies will be off-list ;-) - Chris

« previous php.internals (#42326) next »