Home > Backend Development > PHP Tutorial > foreach引用问题

foreach引用问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:10:16
Original
1009 people have browsed it

foreach($arr as $k=>&$v){} 到底是&v=元素值 还是$v=&name(元素值)

回复内容:

foreach($arr as $k=>&$v){} 到底是&v=元素值 还是$v=&name(元素值)

$v就是数组中元素的值,只不过不使用引用是foreach是拷贝元素值到$v里,所以修改$v时不会影响数组里的值,而使用引用时修改能直接体现在数组上。

Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template