adplus-dvertising
frame-decoration

Question

What will be the output of the following PHP code ?
<?php
for ($i = 0; $i < 3; $i++)
{
    for($j = $i; $j > 0; $j--)
        print " ";
    for($k = $j; $k < 3; $k++)
        print "*";
 print "\n";  
}
?>

a.


*
**
***

b.

***
**
*

c.

*

d.

error

Posted under PHP

Answer: (a).
*
**
***

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following PHP code ?