输出时和注释的结果部一直
Spring21
Spring21 2017-02-06 17:25:50
0
2
1092

$x=10;

$y=20;

function test(){

global $x,$y; //使用global关键字

$y=$x+$y;

}

test();

echo $y;//输出30

global $x,$y; //使用global关键字

$y=$x+$y;

}

test();

echo $y;//输出30

这段代码怎么输入还是 20 呢?

Spring21
Spring21

reply all (2)
数据分析师

When outputting, the result of the annotation is always the same - PHP Chinese website Q&A - When outputting, the result of the annotation is always the same - PHP Chinese website Q&A

Take a look around and learn.

    Ty80

    考虑到php版本的兼容性问题,不建议这么写,推荐的写法如下:

    
              


      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!