Jump to content


Photo

What does?


  • Please log in to reply
3 replies to this topic

#1 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 07 October 2006 - 02:50 AM

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

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

#2 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 07 October 2006 - 03:44 AM

Bump.

#3 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 07 October 2006 - 03:51 AM

& = a reference pointer operator in PHP

$somevariable = "test";
$newvariable = &$somevariable;
echo $newvariable . "<br />";
$somevariable = "test2";
echo $newvariable;

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

Try that code.

And then try ouputting thae code taking the & out.

#4 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 07 October 2006 - 03:59 AM

Oh that's neat.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users