Passing arrays by reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

I've seen several examples of passing arrays by reference such as the
following:

$a = array();

function foo(&a)
{
	for ($i=0; $i < 10; i++) 
	{
		$a[$i] = $i;
	}
}

foo($a);
echo "<PRE>";
print_r($a);
echo "</PRE>";

However, when I try this on my setup, it doesn't work and I get the
following error message:

PHP Parse error:  parse error, unexpected T_STRING, expecting T_VARIABLE
in...

Anyone have any ideas or suggestions?

Thanks,
Jim

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux