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


-- 
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