blob: 5042b72e4b552a23e984082ff871ac91ea470814 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
--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);
?>
--EXPECT--
-- 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"
|