Challenge yout self?
Can you write only 5 lines of php code to make output like this?
- 5 lines of code
- without for, forach, & while
- dynamic level
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
You can run it via terminal or command line:
Set your working directory to ./php-dynamic-pyramid
type php php-dynamic-pyraid.php then enter
or open it via browser.
To simulate of using native php recursive function without using for, foreach, & while.
Sample output:
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
0.0052859783172607
One-side-up pyramid:
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
0.0028870105743408
One-side-bottom pyramid:
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*
0.0045459270477295