31. What will be the output of the following PHP code ?
<?php
$a = "hello";
if (strlen($a))
print strlen($a);
else
print "hi";
?>
<?php
$a = "hello";
if (strlen($a))
print strlen($a);
else
print "hi";
?>
32. What will be the output of the following PHP code ?
<?php
$a = "1";
$b = "0";
if ((int)$a && $b)
print"hi";
else
print "hello";
?>
<?php
$a = "1";
$b = "0";
if ((int)$a && $b)
print"hi";
else
print "hello";
?>
33. What will be the output of the following PHP code ?
<?php
$a = "1";
switch ($a)
{
case 1:
print "hi";
case 2:
print "hello";
default:
print "hi1";
}
?>
<?php
$a = "1";
switch ($a)
{
case 1:
print "hi";
case 2:
print "hello";
default:
print "hi1";
}
?>
34. What will be the output of the following PHP code ?
<?php
$a = "2";
switch ($a)
{
case 1:
print "hi";
case 2:
print "hello";
break;
default:
print "hi1";
}
?>
<?php
$a = "2";
switch ($a)
{
case 1:
print "hi";
case 2:
print "hello";
break;
default:
print "hi1";
}
?>
35. What will be the output of the following PHP code ?
<?php
$a = "1";
switch($a)
{
case 1:
break;
print "hi";
case 2:
print "hello";
break;
default:
print "hi1";
}
?>
<?php
$a = "1";
switch($a)
{
case 1:
break;
print "hi";
case 2:
print "hello";
break;
default:
print "hi1";
}
?>
36. What will be the output of the following PHP code ?
<?php
$a = "1";
$a = 1;
$b = 1;
switch($a)
{
case $a * $b:
print "hi";
break;
case $a / $b:
print "hello";
break;
default:
print "hi1";
}
?>
<?php
$a = "1";
$a = 1;
$b = 1;
switch($a)
{
case $a * $b:
print "hi";
break;
case $a / $b:
print "hello";
break;
default:
print "hi1";
}
?>
37. What will be the output of the following PHP code ?
<?php
$a = 97;
switch(?$a)
{
case "a":
print "hi";
break;
case 97:
print "hello";
break;
default:
print "hi1";
}
?>
<?php
$a = 97;
switch(?$a)
{
case "a":
print "hi";
break;
case 97:
print "hello";
break;
default:
print "hi1";
}
?>
38. What will be the output of the following PHP code ?
<?php
$b = 1;
switch($b)
{
case 1.0:
print "hi";
break;
case 1:
print "hello";
break;
default:
print "hi1";
}
?>
<?php
$b = 1;
switch($b)
{
case 1.0:
print "hi";
break;
case 1:
print "hello";
break;
default:
print "hi1";
}
?>
39. What will be the output of the following PHP code ?
<?php
const $b = 1;
switch($b)
{
case 1:
print "hi";
break;
case 1:
print "hello";
break;
default:
print "hi1";
}
?>
<?php
const $b = 1;
switch($b)
{
case 1:
print "hi";
break;
case 1:
print "hello";
break;
default:
print "hi1";
}
?>
40. What will be the output of the following PHP code ?
<?php
$b = 1;
switch(print $b)
{
case 2:
print "hello";
break;
case 1:
print "hi";
break;
default:
print "hi1";
}
?>
<?php
$b = 1;
switch(print $b)
{
case 2:
print "hello";
break;
case 1:
print "hi";
break;
default:
print "hi1";
}
?>