1--TEST-- 2Pass same variable by ref and by value. 3--FILE-- 4<?php 5function valRef($x, &$y) { 6 var_dump($x, $y); 7 $x = 'changed.x'; 8 $y = 'changed.y'; 9} 10 11function refVal(&$x, $y) { 12 var_dump($x, $y); 13 $x = 'changed.x'; 14 $y = 'changed.y'; 15} 16 17 18echo "\n\n-- Val, Ref --\n"; 19$a = 'original.a'; 20valRef($a, $a); 21var_dump($a); 22 23echo "\n\n-- Ref, Val --\n"; 24$b = 'original.b'; 25refVal($b, $b); 26var_dump($b); 27?> 28--EXPECT-- 29-- Val, Ref -- 30string(10) "original.a" 31string(10) "original.a" 32string(9) "changed.y" 33 34 35-- Ref, Val -- 36string(10) "original.b" 37string(10) "original.b" 38string(9) "changed.x" 39