3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function cross($h) { $out = ""; for ($i = 0; $i<$h; $i++) { $endPos = $h - $i - 1; $out .= $endPos; for ($j = 0; $j<$h; $j++) { $out .= ($j == $i || $j == $endPos) ? "*" : " "; } $out .= "<br>"; } echo $out; } cross(9); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
8* *<br>7 * * <br>6 * * <br>5 * * <br>4 * <br>3 * * <br>2 * * <br>1 * * <br>0* *<br>