php - How can I make an array of times with half hour intervals? -
i needed list of times in array...
12am 12:30am 1:00pm ...
how can php?
thank-you reopening question alex.
this solution should resonate functional programmers.
function halfhourtimes() { $formatter = function ($time) { if ($time % 3600 == 0) { return date('ga', $time); } else { return date('g:ia', $time); } }; $halfhoursteps = range(0, 47*1800, 1800); return array_map($formatter, $halfhoursteps); }
Comments
Post a Comment