I need to create a pyramid using asterisks. I specify a value which becomes the base of the pyramid. The base contains as much asterisks as the value specified and the pyram
Just make it simpler:
function create_pyramid($limit) { for($row = 1; $row < $limit; $row ++) { $stars = str_repeat('*', ($row - 1) * 2 + 1); $space = str_repeat(' ', $limit - $row); echo $space . $stars . ''; } } echo "" ; create_pyramid(10);
" ; create_pyramid(10);