php 的引用传值
php 函数传值 方式,数值传值,引用传值(&)
$app = array(
'a',
'b',
'c',
);
echo $app[0]."\n";
function modify_aa($a){
if(is_array($a)){
$a[0]="1";
}
}
function modify_bb(&$a){
if(is_array($a)){
$a[0]="1";
}
}
modify_aa($app);
echo $app[0]."\n";
modify_bb($app);
echo $app[0]."\n";
结果
a
a
1
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号