Example 1 — Convert a Few IPv4 Addresses
Call ip2long() on common addresses and print the integers with var_export().
<?php
var_export(ip2long('127.0.0.1'));
echo PHP_EOL;
var_export(ip2long('8.8.8.8'));
echo PHP_EOL;
var_export(ip2long('0.0.0.0'));
echo PHP_EOL; How It Works
- ip2long('127. 0.0.1') becomes 2130706433.
- ip2long('8. 8.8.8') becomes 134744072.
- ip2long('0. 0.0.0') becomes 0.
- var_export() prints the raw integer so you can see the exact type.

