Home >Backend Development >PHP Tutorial > php 的引述传值

php 的引述传值

WBOY
WBOYOriginal
2016-06-13 13:05:40794browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn