3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gap($g, $m, $n) { foreach (range($m, $n) as $num) { var_dump($num); var_dump($isPrime = isPrime($num) && isset($firstPrime) && $num - $firstPrime == $g); if ($isPrime = isPrime($num) && isset($firstPrime) && $num - $firstPrime == $g) { return [$firstPrime, $num]; } elseif ($isPrime) { $firstPrime = $num; } } return null; } function isPrime($num) { for ($n = 2; ($div = $num/$n) > $n; $n++) { if (is_int($div)) { return false; } } return true; } gap(2, 100, 110);
based on jNueF
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc3
int(100) bool(false) int(101) bool(false) int(102) bool(false) int(103) bool(false) int(104) bool(false) int(105) bool(false) int(106) bool(false) int(107) bool(false) int(108) bool(false) int(109) bool(false) int(110) bool(false)