Home

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $i = 2;
while (++$i){ while (--$i > 0) print $i;
} ?>

A. 210

B. 10

C. no output

D. infinite loop

Correct Answer :

D. infinite loop


The loop never ends as i is always incremented and then decremented.

Related Questions

What will be the output of the following PHP code ? <?php define(NEW_GOOD_NAME_CONSTANT,… What will be the output of the following PHP code ? <?php $i = 0;while(++$i… If session.use_cookie is set to 0, this results in use of.. If the format is F then which one of the following will be returned? Which of the following PHP statements will output Hello World on the screen?i)… What will be the output of the following PHP code ? <?php define(GREETING,… What will be the output of the following PHP code ? <?php $i = 2;while… What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following PHP code? <?php $a = array(red,… What will be the output of the following PHP code ? <?php $i = 0;while… What will be the output of the following PHP code ? <?php $i = 0;while… What will be the output of the following PHP code? If say date is 22/06/2013.… What will be the output of the following PHP code ? <?php $color1 =… Which of following variables can be assigned a value to it?i) $3helloii)… What will be the output of the following PHP code? <?php $a = array(a=>red,… Which one of the following is the very first task executed by a session… Which one of the following format parameter can be used to identify timezone? Which one of the following is the default PHP session name? The date() function returns ___ representation of the current date and/or… What will be the output of the following PHP code ? <?php define('GREETING_TEST',… What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following PHP code? <?php $a = array(A,… What will be the output of the following PHP code? <?php echo (checkdate(4,31,2010)… What will be the output of the following PHP code ? <?php $i = 2;while… What will be the output of the following PHP code ? <?php $i = 5;while… What will be the output of the following PHP code ? <?php $color1 =… Which of the following must be installed on your computer so as to run… PHP files have a default file extension of.. What will be the output of the following PHP code ? <?php $i = 5;while… A PHP script should start with ___ and end with ___: