31. What will be the output of the following PHP code?
<?php
function sum($num1, $num2)
{
$total = $num1 + $num2;
echo "chr($total)";
}
$var1 = "sum";
$var1(5, 44);
?>
<?php
function sum($num1, $num2)
{
$total = $num1 + $num2;
echo "chr($total)";
}
$var1 = "sum";
$var1(5, 44);
?>
32. What will be the output of the following PHP code?
<?php
function sum($num1, $num2)
{
$total = $num1 + $num2;
echo "cos($total)";
}
sum(5,-5);
?>
<?php
function sum($num1, $num2)
{
$total = $num1 + $num2;
echo "cos($total)";
}
sum(5,-5);
?>
33. What will be the output of the following PHP code?
<?php
function b()
{
echo "b is executed";
}
function a()
{
b();
echo "a is executed";
b();
}
a();
?>
<?php
function b()
{
echo "b is executed";
}
function a()
{
b();
echo "a is executed";
b();
}
a();
?>
34. What will be the output of the following PHP code?
<?php
function addFunction($num1, $num2)
{
$sum = $num1 + $num2;
return $sum;
}
$return_value = addFunction(10, 20);
echo "Returned value from the function : $return_value"
?>
<?php
function addFunction($num1, $num2)
{
$sum = $num1 + $num2;
return $sum;
}
$return_value = addFunction(10, 20);
echo "Returned value from the function : $return_value"
?>
35. What will be the output of the following PHP code?
<?php
function sayHello()
{
echo "HelloWorld<br />";
}
$function_holder = "sayHello";
$function_holder();
?>
<?php
function sayHello()
{
echo "HelloWorld<br />";
}
$function_holder = "sayHello";
$function_holder();
?>
36. What will be the output of the following PHP code?
span>
function one()
{
echo " this works";
function two()
{
echo "this too works";
}
}
one();
two();
?>
span>
function one()
{
echo " this works";
function two()
{
echo "this too works";
}
}
one();
two();
?>
37. What will be the output of the following PHP code?
<?php
function do($myString)
{
echo strpos($myString, "donkey",0);
}
do("The donkey looks like a horse.");
?>
<?php
function do($myString)
{
echo strpos($myString, "donkey",0);
}
do("The donkey looks like a horse.");
?>
38. What will be the output of the following PHP code?
<?php
function onespan>()
{
define("const","I am awesome!");
echo constant("const");
}
one();
?>
<?php
function onespan>()
{
define("const","I am awesome!");
echo constant("const");
}
one();
?>
39. What will be the output of the following PHP code?
<?php
$title = "O'malley wins the heavyweight championship!";
echo ucwords($title);
?>
<?php
$title = "O'malley wins the heavyweight championship!";
echo ucwords($title);
?>
40. What will be the output of the following PHP code?
<?php
echo str_pad("Salad", 5)." is good.";
?>
<?php
echo str_pad("Salad", 5)." is good.";
?>