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 37 38---> Pass constant assignment by reference: 39 40Notice: Only variables should be passed by reference in %s on line 9 41string(10) "a.original" 42string(10) "a.original" 43 44 45---> Pass variable assignment by reference: 46 47Notice: Only variables should be passed by reference in %s on line 15 48string(10) "a.original" 49string(10) "a.original" 50 51 52---> Pass reference assignment by reference: 53string(10) "a.original" 54string(9) "a.changed" 55 56 57---> Pass concat assignment by reference: 58 59Notice: Only variables should be passed by reference in %s on line 28 60string(20) "b.originala.original" 61string(10) "a.original" 62