Home > Backend Development > PHP Tutorial > 一个0开头的数据循环累加的有关问题

一个0开头的数据循环累加的有关问题

WBOY
Release: 2016-06-13 12:13:17
Original
1128 people have browsed it

一个0开头的数据循环累加的问题
今天要批量生成一批合同号,遇到问题了,比如说
start=0066812~end=0066818

for ($start;$start除了0066812之外,后面的全将00给去掉了,请问有什么方法可以保留住0的??
------解决思路----------------------

$start = 66812;<br />$end = 66818;<br /><br />for ($start;$start<=$end;$start++){<br />  $s = sprintf('%07d', $start);<br />  echo $s . '<br>';<br />}
Copy after login
0066812<br />0066813<br />0066814<br />0066815<br />0066816<br />0066817<br />0066818<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