Increment Hex Values in PHP

Hex values aren’t just for colors! I recently had to generate a list of values from 00-ff and came up with this little snippet. Here’s how to increment hex values in PHP:

For Reference:

Hex Values Use (line 8)
0-f $x < 16
00-ff $x < 256
000-fff $x < 65536
(Continue to multiply by 16.)

Was this post helpful?