3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $max_chars = 7; for($num_stars = 1; $num_stars <= $max_chars; $num_stars += 2) { $dashes = ($max_chars - $num_stars) / 2; echo str_repeat('-', $dashes); // Print L dashes echo str_repeat('*', $num_stars); // Print starts echo str_repeat('-', $dashes); // Print R dashes echo "\n"; }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
---*--- --***-- -*****- *******