fork download
  1. <?php
  2. $a = 1;
  3.  
  4. /**** Look at memory ****/
  5.  
  6. /*
  7.  _________________________________________
  8. |pointer | value | variable's |
  9.  -----------------------------------------
  10. | 1 | 1 | $a |
  11.  ----------------------------------------- */
  12.  
  13. $b =& $a;
  14.  
  15. /*
  16.  _________________________________________
  17. |pointer | value | variable's |
  18.  -----------------------------------------
  19. | 1 | 1 | &a, $b |
  20.  ----------------------------------------- */
  21.  
  22. unset($a);
  23.  
  24. /*
  25.  _________________________________________
  26. |pointer | value | variable's |
  27.  -----------------------------------------
  28. | 1 | 1 | $b |
  29.  ----------------------------------------- */
  30.  
  31.  
  32. printf("Variable b is pointing to the pointer 1 which value = %d",$b);
  33.  
  34. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Variable b is pointing to the pointer 1 which value = 1