fork(3) download
  1. <?php
  2.  
  3. class AClass
  4. {
  5. public function __construct ()
  6. {
  7. $this->prop = "Hello";
  8. }
  9. public function &get ()
  10. {
  11. return $this->prop;
  12. }
  13. protected $prop;
  14. }
  15.  
  16. function func ($ref)
  17. {
  18. $ref = &$ref->get();
  19. }
  20.  
  21. $value = new AClass();
  22. func($value);
  23. var_dump( $value );
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
object(AClass)#1 (1) {
  ["prop":protected]=>
  string(5) "Hello"
}