How do I repeat the serial numbers from 000 to 999 in php and save it in a txt file

  php

How do I repeat the serial numbers from 000 to 999 in php and save it in a txt file

For example, I have this code

    <?php    
$bb=fopen('log.txt','w');
for ($i=0;$i<=999;$i++) 
    echo str_pad($i,5,"0",STR_PAD_LEFT),"n","<br/>";
fwrite($bb,"$i");
fclose($bb);
?>

I want to make it like this

    <?php    
$bb=fopen('log.txt','w');
for ($i=0;$i<=999;$i++) 
    $mm = str_pad($i,5,"0",STR_PAD_LEFT),"n","<br/>";
fwrite($bb,"$mm");
fclose($bb);
?>

Source: Ask PHP

LEAVE A COMMENT