Page 1 of 1

Whats the difference between =& and &$variable

Posted: Fri May 13, 2005 5:22 pm
by Ambush Commander
You can:

Code: Select all

$variable  = 'asdf';

$reference1 =& $variable;
$reference2 = &$varable;
And you can also:

Code: Select all

function foo($var) {
   $var = 'bling2';
}

function bar(&$var) {
   $var = 'bling3';
}

$var = 'blinger';

foo(&$var);
bar($var);
bar(&$var);
What's the difference (they all seem to do the same thing)?

Posted: Fri May 13, 2005 5:34 pm
by timvw
it's all explained here: http://www.php.net/references