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

php 的引述传值

WBOY
Release: 2016-06-13 13:05:40
Original
795 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template