Assign reference to a variable : Reference « Language Basics « PHP






Assign reference to a variable


<?php
   $value1 = "Hello";
   $value2 =& $value1; /* $value1 and $value2 both equal "Hello". */
   $value2 = "Goodbye"; /* $value1 and $value2 both equal "Goodbye". */

   echo($value1);
   echo($value2);
?>

           
       








Related examples in the same category

1.unset reference variables
2.Variable References Demo
3.Assigning a Variable by Reference