小弟我不是标题党,小弟我真的很弱

WBOY
Release: 2016-06-13 10:20:16
Original
789 people have browsed it

我不是标题党,我真的很弱。
弱弱的问一下, &$a 是什么意思?&有什么作用?
  问完我就潜了、、太丢人了,基础的变量问题……

------解决方案--------------------
引用。参考:http://www.php.net/manual/zh/language.references.whatdo.php
------解决方案--------------------
引用 的话 $b =& $a;
------解决方案--------------------
有时候我们foreach 的时候想修改数组的值
例如
$arr=array(1,2,3);

foreach ($arr as &$value){
$value++;
}

print_R($arr);

这个时候数组的内容就成了
Array
(
[0] => 2
[1] => 3
[2] => 4
)
------解决方案--------------------
这个东西可以不用。写出来的码,照样好用。


等你有一定的基础了。或者在程序中遇到了。自然就明白了
------解决方案--------------------

探讨
弱弱的问一下, &$a 是什么意思?&有什么作用?
问完我就潜了、、太丢人了,基础的变量问题……
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!