I've tried building and placing the while loop in different ways and different locations and looking at $val as the right/wrong variable to be placing in the while loop but I'm just not getting it. I expected output to be: 815 830 845 900....... until reaching 1900.
Instead I got 815 then 1915 1930 1945 up through 0000 then it cycles over starting at 1915. Someone please tell me what i have placed in the wrong location or what variable I've used wrongly.
date_default_timezone_set('America/New_York');
$st='800';
$et='1900';
$frac = 900;
$x = $et;
$val=0;
if (strlen($st) < 4) {$st = "0".$st;}
$current_time = strtotime(date($st));
$r = $current_time % $frac;
$new_time = $current_time + ($frac-$r);
$val = date('Gi', $new_time);
echo $val."<br>";
while ($val !== $et){
if (strlen($val) < 4) {$st = "0".$val;}
$current_time = strtotime('+ 15 minutes',date($val));
$r = $current_time % $frac;
$new_time = $current_time + ($frac-$r);
$val = date('Gi', $new_time);
echo $val."<br>";
}
NOTE TO THE - MARKDOWN PLAYERS -- Edited POST ANSWER: You can bash the question all you want, but the fact is it was a clear question, clear objective trying to be reached and it was a clear attempt (one of several) to code it properly that failed, so bad code, not bad effort. So eventually I asked for help. Your using the markdown system the wrong way and for the wrong reason, but whatever I have little expectation that you care. Thanks to those that made the effort actually be constructive and teach/help.