Create a script to construct the following pattern, using a nested for loop
<?php $n=5; for($i=1; $i<=$n; $i++) { for($j=1; $j<=$i; $j++) { echo ' * '; } echo '\n'; } for($i=$n; $i>=1; $i--) { for($j=1; $j<=$i; $j++) { echo ' * '; } echo '\n '; } ?>
Sample Output:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer