Home > Backend Development > PHP Tutorial > 新手请问PHP如何批量循环打印出四位数的数字

新手请问PHP如何批量循环打印出四位数的数字

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:51:56
Original
883 people have browsed it

新手请教PHP怎么批量循环打印出四位数的数字?
比如我要打印
0000
0001
0002
0003
......
9999
这样的四位数的数字,请问该用什么方式实现?

------解决方案--------------------

for ($i=0; $i < 10000; $i++) { <br />	echo str_pad($i, 4,'0',STR_PAD_LEFT )."<br />";<br />}
Copy after login

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