Re: Is this a missing feature?

From: Date: Sun, 04 Feb 2001 19:01:00 +0000
Subject: Re: Is this a missing feature?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-38134@lists.php.net to get a copy of this message
At 8:40 PM +0200 2/4/01, Teodor Cimpoesu wrote:
Lux wrote:
Where do I make a formal request for a feature? In Perl or Ruby, I could have said: foo ({ 'var1' => 'value', 'var2' => 'value'}); and it is so much more elegant than having to say: $hash = array (
    'var1' => 'value',
    'var2' => 'value'
); foo ($hash); elegance is everything, man. lux
lux in latin means 'light' right? :) let me enlighten then :-P foo ($hash = array('var1'=>'value', 'var2'=>'value')); should work.
And just to turn up the wattage a little further (hey, I work for the University of California whose motto is 'Fiat Lux', menaing either Lux drives an Italian car or 'Let there be light')... You don't need the $hash in that function call unless you need to use it later on in your main program, so you can just say: foo (array('var1'=>'value', 'var2'=>'value')); which is basically the same as the Perl or Ruby (??? never heard of that...) call above, with the addition of array(...). I use the function(array('param1'=>'value', ...)) syntax a lot instead of individual parameters in function calls. I don't have to remember function argument order that way. - steve
Now, I don't undestand why exactly do you need references. By default everything is passed in a referenced manner, if I undestood correct the explanation Zeev wrote right after 4.0 was out, or so. Don't take references like something that will boost your skript speed to 200%. Use them only when you need them, and to find out when you actually need them check out an article on references at zend.com. Now, let me tell you that somehow I agreed with you :) cause I love Python way of dealing with arrays, but we are in PHP, so we have to figure PHP way, not <your-fav-lang> way. ciao -- teodor
-- +--- "They've got a cherry pie there, that'll kill ya" ------------------+ | Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +-------------------------------------- FBI Special Agent Dale Cooper ---+

« previous php.general (#38134) next »