Object Assignment


/ Published in: HTML
Save to your folder(s)

PHP: The Basics - Manual


Copy this code and paste it in your HTML
  1. <pre>
  2.  
  3. <?php
  4. $assigned = $instance;
  5. $reference =& $instance;
  6.  
  7. $instance->var = '$assigned will have this value';
  8.  
  9. $instance = null; // $instance and $reference become null
  10.  
  11. var_dump($instance);
  12. var_dump($reference);
  13. var_dump($assigned);
  14. ?>
  15.  
  16.  
  17. <hr>
  18.  
  19. The above example will output:
  20.  
  21. NULL
  22. NULL
  23. object(SimpleClass)#1 (1) {
  24. ["var"]=>
  25. string(30) "$assigned will have this value"
  26. }
  27. </pre>

URL: http://us3.php.net/class

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.