3v4l.org

run code in 300+ PHP versions simultaneously
<?php $l = array_fill(0, 25, ''); function clamp($n) { return ($n > 3) ? 3 : $n; } foreach($l as $i=>$b) { echo $i . ' => ' . clamp($i) . '\n'; }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 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
0 => 0\n1 => 1\n2 => 2\n3 => 3\n4 => 3\n5 => 3\n6 => 3\n7 => 3\n8 => 3\n9 => 3\n10 => 3\n11 => 3\n12 => 3\n13 => 3\n14 => 3\n15 => 3\n16 => 3\n17 => 3\n18 => 3\n19 => 3\n20 => 3\n21 => 3\n22 => 3\n23 => 3\n24 => 3\n

preferences:
253.94 ms | 406 KiB | 329 Q