graham23s Posted December 5, 2007 Share Posted December 5, 2007 Hi Guys, i'm doing a range for minutes in an hour like: $mins = range(00,59); for the minutes in an hour but when i run it in a foreach it's getting displayed as: 1 2 3 instead of 01 02 03 it seems to cut the first 0 off, is there any other way of keeping it like the range i have specified ata ll? thanks guys Graham Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 5, 2007 Share Posted December 5, 2007 <?php $mins = range(0,59); foreach ($mins as $min){ if (strlen($min) <= 1) $min = '0'.$min; echo $min.'<br>'; } ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 5, 2007 Share Posted December 5, 2007 spirntf or number_format would be better here Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.