Rodolfo Bandeira
← Archive
Article

How to sum a number to an IP Address using PHP?

· 1 min read


Hi there!

Today I got a situation that I needed to sum a number to an IP Address. So.. check this simple solution to solve it using PHP:

<?php
echo long2ip( ip2long("192.168.23.2") + 1);
?>

You can see this code running in this website: https://codepad.org/oiAOiqmX

Rodolfo