objects_019.phpt 397 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Testing references of dynamic properties
  3. --FILE--
  4. <?php
  5. error_reporting(E_ALL);
  6. $foo = array(new stdclass, new stdclass);
  7. $foo[1]->a = &$foo[0]->a;
  8. $foo[0]->a = 2;
  9. $x = $foo[1]->a;
  10. $x = 'foo';
  11. var_dump($foo, $x);
  12. ?>
  13. --EXPECT--
  14. array(2) {
  15. [0]=>
  16. object(stdClass)#1 (1) {
  17. ["a"]=>
  18. &int(2)
  19. }
  20. [1]=>
  21. object(stdClass)#2 (1) {
  22. ["a"]=>
  23. &int(2)
  24. }
  25. }
  26. string(3) "foo"