Vidyalelo
PHP · all questions

Functions
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

81

Questions

4/5

Page

Pick an option on a question to see the right answer and solution.

What will be the output of the following PHP code ?
<?php
function test($int)
{
    if ($int == 1)
        echo "This Works";
    if ($int == 2)
        echo "This Too Seems To Work";
}
test(1);
TEST(2);
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function mine($num)
{
    num;
    echo $num;
}
mine(3);
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function mine($num)
{
    num;
    echo "$num";
}
mine(3);
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function movie($int)
{
    $movies = array("Fight Club", "Kill Bill", "Pulp Fiction");
    echo "You Do Not Talk About ". integer];
}
movie(0);
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function addFunction(num2)
{
    num1 + $num2;
    return $sum;
}
$return_value = addFunction(10, 20);
echo "Returned value from the function : " .$return_value
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function time($string)
{
    echo strtr("Towe Pa55", "ow5", $string);
}
time("ims");
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function constant()
{
    define("GREETING", "Welcome to Narnia");
    echo greeting;
}
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function constant()
{
    define("GREETING", "Welcome to Narnia",true);
    echo greeting;
}
?>

Select an option to see the answer and solution.

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!";
}
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function email()
{
    $email =[email protected]’;
    email, ‘@');
    echo $new;
}
email();
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
function string()
{
    echo strstr("Hello world!", 111);
}
string();
?>

Select an option to see the answer and solution.

 . . . . . converts the keys of an array into values and the values into keys.

Select an option to see the answer and solution.

Above usleep() function pauses PHP for .
usleep(1000000);

Select an option to see the answer and solution.

Output will be:
$array = array(0, 1, 2);
array, -6, ‘NEW’);

Select an option to see the answer and solution.

phpinfo() will display about?
1. OS version information
2. PHP installation
3. Variables
4. HTTP headers

Select an option to see the answer and solution.

 . . . . returns a new DateTime object.

Select an option to see the answer and solution.

It is always necessary to use parentheses with the print function.

Select an option to see the answer and solution.

The below statement will return.
$Var = substr(""abcdef"", -4, 1);

Select an option to see the answer and solution.

Returning values from functions may include .....

Select an option to see the answer and solution.

The arguments in a function are evaluated from .....

Select an option to see the answer and solution.