What is the best way to get /24 blocks from IP address ranges?

I am trying to figure out what the best/most efficient way to get individual /24 IP blocks from a range of IP addresses using PHP.

I have ranges of IP addresses in an MySQL database (I cannot change how this is presented) and have to have individual ranges of /24 blocks saved, also in a specific way (I cannot change the MySQL entries, nor how the software processes the list).

For example, I have various ranges of IPv4 IP addresses in this format:

86.111.160.0 - 86.111.175.255

Which I need to save in this format:

86.111.160.0
86.111.161.0
86.111.162.0
...
86.111.175.0

I’m having a bit of a block on how to do this without writing something hugely complicated to process each line.

Is there any function in PHP that can help me with this?

Thanks in advance.