Converting Binary Data to IP Address (and vice versa)

by May 28, 2013

In a previous tip we showed how you can display an IPv4 address as a binary. Here's an even faster (and more cryptic) way:

$ipV4 = ''

The result looks like this:

Now how would you do the opposite and turn a binary into an IP address? Here's how:

$IPBinary = '11000000101010000000110000100001'

Twitter This Tip! ReTweet this Tip!