"Cat",2=>"Horse",3=>"Bird"); for ($i = 0; $i "/> "Cat",2=>"Horse",3=>"Bird"); for ($i = 0; $i ">
Home > Backend Development > PHP Tutorial > 小弟我想问一下以下这段代码为什么会输出这样的结果?不是应该全部为空吗

小弟我想问一下以下这段代码为什么会输出这样的结果?不是应该全部为空吗

WBOY
Release: 2016-06-13 12:39:20
Original
845 people have browsed it

我想问一下以下这段代码为什么会输出这样的结果?不是应该全部为空吗?

<br />
$a1=array(0=>"Dog",1=>"Cat",2=>"Horse",3=>"Bird");<br />
for ($i = 0; $i < count($a1); $i++) {<br />
	array_splice($a1,$i, 1);<br />
}<br />
print_r($a1);<br />
Copy after login


效果:
Array ( [0] => Cat [1] => Bird )
PHP

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