Re: Is this a missing feature?

From: Date: Sun, 04 Feb 2001 18:26:37 +0000
Subject: Re: Is this a missing feature?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-38125@lists.php.net to get a copy of this message
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 Christian Reiniger wrote:
On Sunday 04 February 2001 07:31, John Luxford wrote:
    function foo (&$hash) {
       while (list ($k, $v) = each ($hash)) {
          echo "$k :: $v<br />\n";
       }
    }
    // but what I want to say is something like this
    foo (["one" => "value", "two" => "value"]);
foo () is declared to take a reference to a variable. This only works with "real" variables, not the temporary ones returned from array() etc. Modify it to
     function foo ($hash) {
and it will work
-- John Luxford Simian Systems w: www.simian.ca e: lux@simian.ca p: 204.946.5955 --

« previous php.general (#38125) next »