3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $range = "194.8.42.0/30"; function ipListFromRange($range){ $parts = explode('/',$range); $exponent = 32-$parts[1].'-'; $count = pow(2,$exponent); $start = ip2long($parts[0]); $end = $start+$count; return array_map('long2ip', range($start, $end) ); } print_r(ipListFromRange($range));
Output for 7.1.0
Notice: A non well formed numeric value encountered in /in/macdb on line 8 Array ( [0] => 194.8.42.0 [1] => 194.8.42.1 [2] => 194.8.42.2 [3] => 194.8.42.3 [4] => 194.8.42.4 )
Output for 4.3.0 - 5.6.28, 7.0.0 - 7.0.14
Array ( [0] => 194.8.42.0 [1] => 194.8.42.1 [2] => 194.8.42.2 [3] => 194.8.42.3 [4] => 194.8.42.4 )
Output for hhvm-3.10.0 - 3.12.0
Array ( [0] => 194.8.42.0 [1] => 194.8.42.1 )