Created
January 4, 2022 18:17
-
-
Save bran921007/ccbb4932cd3306f3567fe46ccfa49e78 to your computer and use it in GitHub Desktop.
Strairs Case code challenge (get reverse stairs * with same height
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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