note 108767 modified in function.range by danbrown
| From: | danbrown@php.net | Date: | Wed, 23 May 2012 18:06:54 +0000 |
| Subject: | note 108767 modified in function.range by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188172@lists.php.net to get a copy of this message | ||
So, I needed a quick and dirty way to create a dropdown select for hours, minutes and seconds using
2 digit formatting, and to create those arrays of data, I combined range with array
merge.. <?php $prepend =
array('00','01','02','03','04','05','06','07','08','09'); $hours
	= array_merge($prepend,range(10, 23)); $minutes 	=
array_merge($prepend,range(10, 59)); $seconds 	=
$minutes; ?> Super simple.
--was--
So, I needed a quick and dirty way to create a dropdown select for hours, minutes and seconds using
2 digit formatting, and to create those arrays of data, I combined range with array merge..
$prepend =
array('00','01','02','03','04','05','06','07','08','09');
$hours = array_merge($prepend,range(10, 23));
$minutes = array_merge($prepend,range(10, 59));
$seconds = $minutes;
Super simple.
http://php.net/manual/en/function.range.php