Posted By

dvdrtrgn on 08/19/08


Tagged

php object assignment


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

dvdrtrgn


Object Assignment


 / Published in: HTML
 

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

PHP: The Basics - Manual

  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>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: dvdrtrgn on November 30, 2008

what the hell is going on here?

You need to login to post a comment.