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 Link to comment https://forums.phpfreaks.com/topic/80337-range-help/ 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>'; } ?> Link to comment https://forums.phpfreaks.com/topic/80337-range-help/#findComment-407178 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 Link to comment https://forums.phpfreaks.com/topic/80337-range-help/#findComment-407181 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.