3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $size = 9; $space = " "; $center = ceil($size/2); $maxPost = abs($center - $size); for ($i=0; $i<$size; $i++) { $post = abs($center + $i - $size); $pre = $maxPost - $post; echo str_repeat($space,$pre); echo "x "; echo str_repeat($space, $post); if ($post > 0) { echo str_repeat($space, $post-1); echo "x "; } echo str_repeat($space, $pre) . "\n"; }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
x x x x x x x x x x x x x x x x x