Examveda
Examveda

What will be the output of the following PHP code ?
<?php
switch($b)
{
case 2:
    print "hello";
    break;
case b:
    print "hi";
    break;
}
?>

A. hello

B. hi

C. no output

D. error

Answer: Option C

Solution(By Examveda Team)

Case cannot be defined by a variable.

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

Join The Discussion

Related Questions on Control Structures(Loop in PHP)