3v4l.org

run code in 300+ PHP versions simultaneously
<?php $period = new DatePeriod( new DateTimeImmutable('2010-05-01'), new DateInterval('P1D'), new DateTimeImmutable('2010-05-10') ); $iteratorOutput = $arrayOutput = ''; foreach ($period as $date) { $iteratorOutput .= $date->format("l Y-m-d H:i:s\n"); } var_dump($iteratorOutput ); foreach (iterator_to_array($period) as $date) { $arrayOutput .= $date->format("l Y-m-d H:i:s\n"); } var_dump($arrayOutput );

preferences:
43.89 ms | 402 KiB | 5 Q