I need to generate and echo values from 00:00:00
to FF:FF.FF
like for counting from 1
to 1000000
. I know with numbers but how with hexadecimal numbers?
for example I need this at echo:
00:00:00
00:00:01
00:00:02
.
.
.
FF:FF:00
FF:FF:01
FF:FF:02
.
.
.
FF:FF:FF
How to do this in PHP?
PHP accepts integer literals in hexdecimal format, so you'd just be iterating from
0
to0xFFFFFF
. For each iteration, you could convert the integer to decimal format, left-pad it with zeroes and then split every to character and implode with:
to get the format you want: