<?php function staircase($n) { $x=1; $y=$n-1; while($x<=$n){ while($y<$n){ echo "#"; $y++; } echo"\n"; $x++; $y=$y-$x; } } staircase(5) ?>