Home >Backend Development >PHP Tutorial > 为什么此段PHP foreach 时打印的值是这样? (2)

为什么此段PHP foreach 时打印的值是这样? (2)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:11:49970browse

 为什么此段PHP foreach 时打印的值是这样?  (2)

输出为int(1) int(1) int(1)
为何?求解谢谢

这个问题已被关闭,原因:与已有问题重复

回复内容:

 为什么此段PHP foreach 时打印的值是这样?  (2)

输出为int(1) int(1) int(1)
为何?求解谢谢

foreach每次循环创建一个新的变量保存当前原始,并未改变$a的实际下标

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