Register now or log in to join your professional community.
<p><?php$sample="example";$tranc=&$sample;$tranc="output";echo $sample;echo $tranc;?>output is output output</p>
=& operator is used to get a reference of a variable. In this case $tranc has a reference of $sample. Try changing the value of $tranc and echo again. You will see the difference.
Cheers
$tranc holds address of $sample (i.e. & basically is used for memory address / reference), thus points to what $sample holds, but the3rd statement is an assignment to $tranc so previous pointer wont work.Now echo'ing $sample will output "example", and $tranc will output the word "output".As far the text after closing tags "?>" will simply be output to client application either browser or whatever.
I hope you understood.
regards