3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function IP2number($ip) { return sprintf('%u', ip2long($ip)); } echo ip2long('0.0.0.0'),"\r\n"; echo ip2long('0.0.0.1'),"\r\n"; echo ip2long('255.255.255.254'),"\r\n"; echo ip2long('255.255.255.255'),"\r\n"; echo "\r\n"; echo IP2number('0.0.0.0'),"\r\n"; echo IP2number('0.0.0.1'),"\r\n"; echo IP2number('255.255.255.254'),"\r\n"; echo IP2number('255.255.255.255'),"\r\n";
based on HvDTU
Output for 4.3.0 - 4.3.4, 5.2.5 - 7.2.11
0 1 4294967294 4294967295 0 1 4294967294 4294967295
Output for 5.2.4
0 1 4294967294 -1 0 1 4294967294 18446744073709551615
Output for 4.3.5 - 4.4.9, 5.0.2 - 5.2.3
0 1 4294967294 -1 0 1 4294967294 4294967295
Output for 5.0.0 - 5.0.1
0 1 4294967294 0 1 4294967294 0