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

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

WBOY
WBOYOriginal
2016-06-13 12:13:171121browse

一个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 />}
0066812<br />0066813<br />0066814<br />0066815<br />0066816<br />0066817<br />0066818<br /><br />

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