Home >Backend Development >PHP Tutorial >在php中$a=&$b;跟$b=&$a;区别

在php中$a=&$b;跟$b=&$a;区别

WBOY
WBOYOriginal
2016-06-13 12:08:071427browse

在php中$a=&$b;和$b=&$a;区别
网上定义是“$a=&$b;意味着$a和$b指向同一个变量,这里$a,$b是完全相同的,并不是$a指向$b或者相反”
那我还有个疑问,
        $b = 50;
        $b = &$a;
        echo $a;
?>
为什么无输出?
ps:新人我刚学php,问题有点2见谅些
------解决思路----------------------
你写 反了吧!!你的$a根本没有初始化,就赋值给$b,当然无输出了

<br /> $b = 50;<br />        $a = &$b;<br />        echo $a;<br />

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