文档上写的很明白:Note: 请注意,传入call_user_func()的参数不能为引用传递然而PHP7.0下 下例活生生的出现了$arr = [10, 100, 100, 0];
$parma = [1, 3, 2, 4];
call_user_func('array_multisort', $arr, $parma);
print_r($arr);
print_r($parma);输出Array(
[0] => 0
[1] => 10
[2] => 100
[3] => 100)Array(
[0] => 4
[1] => 1
[2] => 2
[3] => 3)为什么会这样
2 回答
Helenr
TA贡献1780条经验 获得超3个赞
5.6版本执行的也是这么个情况
<?phpecho "PHP版本:".phpversion(); $arr = [10, 100, 100, 0]; $parma = [1, 3, 2, 4]; call_user_func('array_multisort', $arr, $parma); print_r($arr); print_r($parma); $ar1 = array(10, 100, 100, 0); $ar2 = array(1, 3, 2, 4); array_multisort($ar1, $ar2); print_r($ar1); print_r($ar2);?>
PHP版本:5.6.9-0+deb8u1Array( [0] => 10 [1] => 100 [2] => 100 [3] => 0)Array( [0] => 1 [1] => 3 [2] => 2 [3] => 4)Array( [0] => 0 [1] => 10 [2] => 100 [3] => 100)Array( [0] => 4 [1] => 1 [2] => 2 [3] => 3)
- 2 回答
- 0 关注
- 1632 浏览
添加回答
举报
0/150
提交
取消