fork(2) download
  1. <?php
  2. class Test {
  3. public $a = 111;
  4.  
  5. function &change( $c ) {
  6. return $this->a;
  7. }
  8. };
  9.  
  10. function secret_function( &$arg ) {
  11. $arg = 999;
  12. }
  13.  
  14. $test = new Test();
  15. $prop = $test->change();
  16. echo( "$prop $test->a \n" );
  17. $prop = 555;
  18. echo( "$prop $test->a \n" );
  19. $prop = &$test->change();
  20. $prop = 777;
  21. echo( "$prop $test->a \n" );
  22. secret_function( $test->change() );
  23. echo( "$prop $test->a \n" );
Success #stdin #stdout #stderr 0s 52488KB
stdin
Standard input is empty
stdout
111 111 
555 111 
777 777 
999 999 
stderr
PHP Warning:  Missing argument 1 for Test::change(), called in /home/oIXRZ0/prog.php on line 15 and defined in /home/oIXRZ0/prog.php on line 5
PHP Warning:  Missing argument 1 for Test::change(), called in /home/oIXRZ0/prog.php on line 19 and defined in /home/oIXRZ0/prog.php on line 5
PHP Warning:  Missing argument 1 for Test::change(), called in /home/oIXRZ0/prog.php on line 22 and defined in /home/oIXRZ0/prog.php on line 5