Mega Code Archive

 
Categories / Php / Language Basics
 

$b is assigned a copy of $a, and in the second part, $b is assigned a reference to $a

<?php  $a = 5;  $b = $a;  $a = 7;  echo "\$a = $a and \$b = $b\n";  $a = 5;  $b = &$a;  $a = 7;  echo "\$a = $a and \$b = $b\n";  ?>