Annotation of embedaddon/php/Zend/tests/dereference_008.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Testing array dereference with dynamic method name and references
! 3: --FILE--
! 4: <?php
! 5:
! 6: error_reporting(E_ALL);
! 7:
! 8: class foo {
! 9: public $x = array(1);
! 10:
! 11: public function &b() {
! 12: return $this->x;
! 13: }
! 14: }
! 15:
! 16: $foo = new foo;
! 17:
! 18: $a = 'b';
! 19: var_dump($foo->$a()[0]);
! 20:
! 21: $h = &$foo->$a();
! 22: $h[] = 2;
! 23: var_dump($foo->$a());
! 24:
! 25: ?>
! 26: --EXPECT--
! 27: int(1)
! 28: array(2) {
! 29: [0]=>
! 30: int(1)
! 31: [1]=>
! 32: int(2)
! 33: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>