diff options
Diffstat (limited to 'tests/lang/passByReference_008.phpt')
-rw-r--r-- | tests/lang/passByReference_008.phpt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/lang/passByReference_008.phpt b/tests/lang/passByReference_008.phpt new file mode 100644 index 0000000000..36852170bf --- /dev/null +++ b/tests/lang/passByReference_008.phpt @@ -0,0 +1,40 @@ +--TEST-- +Pass same variable by ref and by value. +--FILE-- +<?php +function valRef($x, &$y) { + var_dump($x, $y); + $x = 'changed.x'; + $y = 'changed.y'; +} + +function refVal(&$x, $y) { + var_dump($x, $y); + $x = 'changed.x'; + $y = 'changed.y'; +} + + +echo "\n\n-- Val, Ref --\n"; +$a = 'original.a'; +valRef($a, $a); +var_dump($a); + +echo "\n\n-- Ref, Val --\n"; +$b = 'original.b'; +refVal($b, $b); +var_dump($b); +?> +--EXPECTF-- + + +-- Val, Ref -- +string(10) "original.a" +string(10) "original.a" +string(9) "changed.y" + + +-- Ref, Val -- +string(10) "original.b" +string(10) "original.b" +string(9) "changed.x"
\ No newline at end of file |