3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isDivisible_x_3($n) { if (strlen($n) == 3){ list($a,$b,$c) = str_split($n); if ($b == $a + 1 && $c == $b + 1){ $mess = "\n$n is divisible by three\n"; $mess .= "\nProof: \$n/3 == " . $n/3; return $mess; } } } $num = 234; echo isDivisible_x_3( $num );
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
234 is divisible by three Proof: $n/3 == 78

preferences:
156.48 ms | 404 KiB | 182 Q