3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
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