<?php
function invertedPyramid($n) {
// Loop for rows
for ($i = $n; $i >= 1; $i--) {
// Print leading spaces
for ($s = 0; $s < $n - $i; $s++) {
echo " ";
}
// Print stars
for ($j = 1; $j <= $i; $j++) {
echo "* ";
}
echo "\n"; // new line
}
}
// Call function
invertedPyramid(4);
?>
