- print_r: documentation ( source)
<?php
$from = new DateTime('1970-01-01 22:00:00');
$to = (clone $from);
$to->modify('+5 hours');
$dp = new DatePeriod($from, new DateInterval('P1H'), $to);
$r = array();
foreach ($dp as $d) {
$r[] = $d->format('hA');
}
print_r($r);