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 |
| [EMAIL PROTECTED]                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+-------------------------------------- FBI Special Agent Dale Cooper ---+

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to