Is this a missing feature?

From: Date: Sun, 04 Feb 2001 06:31:31 +0000
Subject: Is this a missing feature?
Groups: php.general 
Request: Send a blank email to php-general+get-38079@lists.php.net to get a copy of this message
Here's what I'm trying to do: I'd like to pass a hash to a function as a reference, but I don't want to predeclare that hash (I'd like to specify it in the function call). Here's a code example: <?php function foo (&$hash) {
      while (list ($k, $v) = each ($hash)) {
         echo "$k :: $v<br />\n";
      }
} // works this way $bar = array (
      "one" => "value",
      "two" => "value"
); foo ($bar); // but what I want to say is something like this foo (["one" => "value", "two" => "value"]); // what also doesn't work foo ( array ("one" => "value", "two" => "value") ); foo ( list ("one" => "value", "two" => "value") ); ?> Am I missing something? Lux

« previous php.general (#38079) next »