Here is another fun PHP program for the school and college kids those who want to print stars of pyramid using PHP technology.
Here is the code and you can see the demo below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?php if($_GET){ $n = $i = $_GET['stars']; while ($i--){ echo str_repeat(' ', $i).str_repeat('*', $n - $i)."<br>"; } } ?> <html> <head></head> <body> <form> Enter number of lines: <input type="text" name="stars" /> </form> </body> </html> |
Enter the number in the box to see how it works:
Superb ………
Awsome one line logic…Really Appreciable