CSE :: PHP - CS
-
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
?>
-
What will be the output of the following PHP code ?
<?php
function time($string)
{
echo strtr("Towe Pa55", "ow5", $string);
}
time("ims");
?>
-
What will be the output of the following PHP code ?
<?php
function constant()
{
define("GREETING", "Welcome to Narnia");
echo greeting;
}
?>
-
What will be the output of the following PHP code ?
<?php
function constant()
{
define("GREETING", "Welcome to Narnia",true);
echo greeting;
}
?>
-
What will be the output of the following PHP code ?
<?php
function start($string)
{
if ($string < 45)
return 20;
else
return 40;
}
$t = start(90);
if ($t < 20)
{
echo "Have a good day!";
}
else
{
echo "Have a good night!";
}
?>
-
What will be the output of the following PHP code ?
<?php
function email()
{
$email = ’contact@examveda.com’;
$new = strstr($email, ‘@');
echo $new;
}
email();
?>
-
What will be the output of the following PHP code ?
<?php
function string()
{
echo strstr("Hello world!", 111);
}
string();
?>
- . . . . . converts the keys of an array into values and the values into keys.
-
Above usleep() function pauses PHP for .
usleep(1000000);
-
Output will be:
$array = array(0, 1, 2);
$array = array_pad($array, -6, ‘NEW’);
A.
Array ( [1] => NEW [2] => NEW [3] => NEW [4] => 0 [5] => 1 [6] => 2 ) |
B.
Array ( [-1] => NEW [-2] => NEW [-3] => NEW [-4] => 0 [-5] => 1 [-6] => 2 ) |
C.
Array ( [0] => NEW [-1] => NEW [-2] => NEW [-3] => 0 [-4] => 1 [-5] => 2 ) |
D.
Array ( [0] => NEW [1] => NEW [2] => NEW [3] => 0 [4] => 1 [5] => 2 ) |