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

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -