Skip to content

Instantly share code, notes, and snippets.

@bran921007
Created January 4, 2022 18:17
Show Gist options
  • Select an option

  • Save bran921007/ccbb4932cd3306f3567fe46ccfa49e78 to your computer and use it in GitHub Desktop.

Select an option

Save bran921007/ccbb4932cd3306f3567fe46ccfa49e78 to your computer and use it in GitHub Desktop.
Strairs Case code challenge (get reverse stairs * with same height
function staircase($n) {
$staircase = 0;
foreach(range(1,$n) as $i){
echo str_repeat(' ',$n-1).str_repeat('#',$i).PHP_EOL;
$n--;
}
}
staircase(6);
<!--Output: -->
<!--
#
##
###
####
#####
######
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment