blob: 4772f6548dcaefd7172381fd8a4ba10dbe7242a4 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
--TEST--
ReflectionParameter class - canBePassedByValue() method.
--FILE--
<?php
function aux($fun) {
$func = new ReflectionFunction($fun);
$parameters = $func->getParameters();
foreach($parameters as $parameter) {
echo "Name: ", $parameter->getName(), "\n";
echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
echo "\n";
}
}
echo "=> array_multisort:\n\n";
aux('array_multisort');
echo "=> sort:\n\n";
aux('sort');
echo "=> user function:\n\n";
function ufunc(&$arg1, $arg2) {}
aux('ufunc');
echo "Done.\n";
?>
--EXPECTF--
=> array_multisort:
Name: arr1
Is passed by reference: yes
Can be passed by value: yes
Name: SORT_ASC_or_SORT_DESC
Is passed by reference: yes
Can be passed by value: yes
Name: SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING
Is passed by reference: yes
Can be passed by value: yes
Name: arr2
Is passed by reference: yes
Can be passed by value: yes
Name: SORT_ASC_or_SORT_DESC
Is passed by reference: yes
Can be passed by value: yes
Name: SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING
Is passed by reference: yes
Can be passed by value: yes
Name: more_array_and_sort_options
Is passed by reference: yes
Can be passed by value: yes
=> sort:
Name: arg
Is passed by reference: yes
Can be passed by value: no
Name: sort_flags
Is passed by reference: no
Can be passed by value: yes
=> user function:
Name: arg1
Is passed by reference: yes
Can be passed by value: no
Name: arg2
Is passed by reference: no
Can be passed by value: yes
Done.
|