Variable References Demo : Reference « Language Basics « PHP






Variable References Demo


<?php
     $my_foo = "A";
     $my_bar = &$my_foo;
     $my_foo = "B";
   
     print($my_bar);
   
     $my_bar = "C";
     print($my_foo);
?>
           
       








Related examples in the same category

1.Assign reference to a variable
2.unset reference variables
3.Assigning a Variable by Reference