1--TEST-- 2"Reference Unpacking - Class Property and Methods" list() 3--FILE-- 4<?php 5class A { 6 public $a = [['hello']]; 7 public $b = ['world']; 8 9 public function getVar() { 10 return $this->a; 11 } 12 13 public function &getVarRef() { 14 return $this->a; 15 } 16} 17 18class B { 19 static $a = [['world']]; 20} 21 22$a = new A(); 23[&$var] = $a->a; 24[&$var_too] = $a->b; 25var_dump($a->a); 26var_dump($a->b); 27 28$a = new A(); 29[&$var] = $a->getVar(); 30var_dump($a->a); 31 32$a = new A(); 33[&$var] = $a->getVarRef(); 34var_dump($a->a); 35 36[&$var] = B::$a; 37var_dump(B::$a); 38?> 39--EXPECTF-- 40array(1) { 41 [0]=> 42 &array(1) { 43 [0]=> 44 string(5) "hello" 45 } 46} 47array(1) { 48 [0]=> 49 &string(5) "world" 50} 51 52Notice: Attempting to set reference to non referenceable value in %s on line %d 53array(1) { 54 [0]=> 55 array(1) { 56 [0]=> 57 string(5) "hello" 58 } 59} 60array(1) { 61 [0]=> 62 &array(1) { 63 [0]=> 64 string(5) "hello" 65 } 66} 67array(1) { 68 [0]=> 69 &array(1) { 70 [0]=> 71 string(5) "world" 72 } 73} 74