Re: Is this a missing feature?
| From: | Christian Reiniger | Date: | Sun, 04 Feb 2001 12:12:24 +0000 |
| Subject: | Re: Is this a missing feature? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38099@lists.php.net to get a copy of this message | ||
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
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."
- Margaret Mead