3v4l.org

run code in 300+ PHP versions simultaneously
<?php // How many times per day, get from DB $userInput = 17; $SecondsPerDay = 60 * 60 * 24; $Frequency = (int) ($SecondsPerDay / $userInput) -1; $midnight = strtotime('today midnight'); // Get an array of times to execute $executeTimes = array(); for($time=$midnight; $time<=($midnight+$SecondsPerDay); $time+=$Frequency) $executeTimes[] = date("g:i a", $time); print_r($executeTimes);

preferences:
23.91 ms | 406 KiB | 5 Q