3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ipsBetween($from, $to) { return ip2long($to) - ip2long($from); } echo ipsBetween("10.0.0.0", "10.0.0.50") . PHP_EOL; echo ipsBetween("10.0.0.0", "10.0.1.0") . PHP_EOL; echo ipsBetween("20.0.0.10", "20.0.1.0");
based on fCq8e
Output for 7.1.25 - 7.1.31, 7.2.0 - 7.2.33, 7.3.0 - 7.3.26, 7.4.0 - 7.4.14, 8.0.0 - 8.0.2
50 256 246