On Thu, 13 Feb 2003, Chris Boget wrote:
> $firstVar = "123ABC";
>
> $secondVar &= $firstVar;
&= is a bitwise AND, and an assignment.
This didn't do what you expected it to do.
> $thirdVar = &$firstVar;
=& is a reference assignment.
This did what you expected it to do.
> Why? I thought that "&=" made it so that the left operand was
> pointing to the memory location of the right?
You make the left operand point to the memory location of the right
operand with =&. =& is the only reference assignment available, besides
passing/returning by reference with functions.
$stuff = "1234";
$ref =& $stuff; // $ref points to $stuff's data
print $ref . "\n"; // prints "1234"
$stuff = "5678";
print $ref . "\n"; // prints "5678"
hth,
~Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php