1--TEST-- 2Passing assignments by reference 3--FILE-- 4<?php 5 6function f(&$a) { 7 var_dump($a); 8 $a = "a.changed"; 9} 10 11echo "\n\n---> Pass constant assignment by reference:\n"; 12f($a="a.original"); 13var_dump($a); 14 15echo "\n\n---> Pass variable assignment by reference:\n"; 16unset($a); 17$a = "a.original"; 18f($b = $a); 19var_dump($a); 20 21echo "\n\n---> Pass reference assignment by reference:\n"; 22unset($a, $b); 23$a = "a.original"; 24f($b =& $a); 25var_dump($a); 26 27echo "\n\n---> Pass concat assignment by reference:\n"; 28unset($a, $b); 29$b = "b.original"; 30$a = "a.original"; 31f($b .= $a); 32var_dump($a); 33 34?> 35--EXPECTF-- 36---> Pass constant assignment by reference: 37 38Notice: Only variables should be passed by reference in %s on line 9 39string(10) "a.original" 40string(10) "a.original" 41 42 43---> Pass variable assignment by reference: 44 45Notice: Only variables should be passed by reference in %s on line 15 46string(10) "a.original" 47string(10) "a.original" 48 49 50---> Pass reference assignment by reference: 51string(10) "a.original" 52string(9) "a.changed" 53 54 55---> Pass concat assignment by reference: 56 57Notice: Only variables should be passed by reference in %s on line 28 58string(20) "b.originala.original" 59string(10) "a.original" 60