Examveda
Examveda

What will be the output of the following PHP code ?
<?php
$i = "";
while($i)
{   
    print "hi";
}
print "hello";
?>

A. hello

B. infinite loop

C. hihello

D. error

Answer: Option A

Solution(By Examveda Team)

While accept does not accept anything other than a 0 or any other number as false and true.

This Question Belongs to PHP >> Control Structures(Loop In PHP)

Join The Discussion

Related Questions on Control Structures(Loop in PHP)