References are not pointer in PHP5 !

function foo(&$var)
{
$var = 2;
}
$i = 1;
foo($i);
print $i; //prints “2”
but :
function foo(&$var)
{
$i = 2;
$var = &$i;
print $var; //prints “2”
}
$i=1;
foo($i);
print $i; //prints “1” !!!

Returning reference from functions:

function &foo(&$var)
{
$i = 2;
$var = &$i;
return $var;
}
$i=1;
print foo($i); // prints “2”