How to iterate date and time in PHP

We need to iterate date and time between two predefined time moments with a predefined time step.

For example 30 minutes step

1 day step