Jump to content

Archived

This topic is now archived and is closed to further replies.

Eugene

What does?

Recommended Posts

$somevariable = "test";
$somevariable =& "test";

What's the difference? Why is there an "&" symbol?

Share this post


Link to post
Share on other sites
& = a reference pointer operator in PHP

[code=php:0]
$somevariable = "test";
$newvariable = &$somevariable;
echo $newvariable . "<br />";
$somevariable = "test2";
echo $newvariable;
[/code]

That mean, whenever $somevariable changes, $newvariable also changes since it references $somevariable.

Try that code.

And then try ouputting thae code taking the & out.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.