Print a pyramid.
<?php
/**
* 打印金字塔
* @param [int] $level [层数]
* @return [void]
*/
function pyramidPrinter($level){
for ($index = 1; $index <= $level; $index++) {
for ($space = $level; $space > $index; $space--) {
echo "<span style='color:#fff;'>*</span>";
}
for ($star = 1; $star <= $index * 2 - 1; $star++) {
echo "<span>*</span>";
}
for ($space = $level; $space > $index; $space--) {
echo "<span style='color:#fff;'>*</span>";
}
echo "<br>";
}
}