Examveda
Examveda

What will be the output of the following PHP code ?
<?php
$user = array("Ashley", "Bale", "Shrek", "Blank");
for ($x = 0; $x < count($user); $x++) 
{
    if ($user[$x] == "Shrek") 
	    continue;
    printf ($user[$x]); 
}
?>

A. AshleyBaleBlank

B. AshleyBale

C. AshleyBaleShrek

D. No output

Answer: Option A

Solution(By Examveda Team)

Only the Shrek is skipped due to the continue statement.

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

Join The Discussion

Related Questions on Control Structures(Loop in PHP)