3v4l.org

run code in 200+ 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 - 7.2.0
---*--- --***-- -*****- *******