1--TEST--
2ReflectionParameter class - canBePassedByValue() method.
3--FILE--
4<?php
5
6function aux($fun) {
7
8    $func = new ReflectionFunction($fun);
9    $parameters = $func->getParameters();
10    foreach($parameters as $parameter) {
11        echo "Name: ", $parameter->getName(), "\n";
12        echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
13        echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
14        echo "\n";
15    }
16
17}
18
19echo "=> array_multisort:\n\n";
20
21aux('array_multisort');
22
23
24echo "=> sort:\n\n";
25
26aux('sort');
27
28echo "=> user function:\n\n";
29
30function ufunc(&$arg1, $arg2) {}
31
32aux('ufunc');
33
34echo "Done.\n";
35
36?>
37--EXPECTF--
38=> array_multisort:
39
40Name: arr1
41Is passed by reference: yes
42Can be passed by value: yes
43
44Name: sort_order
45Is passed by reference: yes
46Can be passed by value: yes
47
48Name: sort_flags
49Is passed by reference: yes
50Can be passed by value: yes
51
52Name: arr2
53Is passed by reference: yes
54Can be passed by value: yes
55
56=> sort:
57
58Name: arg
59Is passed by reference: yes
60Can be passed by value: no
61
62Name: sort_flags
63Is passed by reference: no
64Can be passed by value: yes
65
66=> user function:
67
68Name: arg1
69Is passed by reference: yes
70Can be passed by value: no
71
72Name: arg2
73Is passed by reference: no
74Can be passed by value: yes
75
76Done.
77