Rodolfo Bandeira

Rodolfo Bandeira

software, electronics, security, devops, thoughts

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

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: http://codepad.org/oiAOiqmX

Rodolfo

Last modified:

LinkedIn
WhatsApp