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_ASC_or_SORT_DESC 45Is passed by reference: yes 46Can be passed by value: yes 47 48Name: SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING 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 56Name: SORT_ASC_or_SORT_DESC 57Is passed by reference: yes 58Can be passed by value: yes 59 60Name: SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING 61Is passed by reference: yes 62Can be passed by value: yes 63 64=> sort: 65 66Name: arg 67Is passed by reference: yes 68Can be passed by value: no 69 70Name: sort_flags 71Is passed by reference: no 72Can be passed by value: yes 73 74=> user function: 75 76Name: arg1 77Is passed by reference: yes 78Can be passed by value: no 79 80Name: arg2 81Is passed by reference: no 82Can be passed by value: yes 83 84Done. 85