PHP Functions
- What will be the output of the following PHP code?
<?php
echo(atan(0.60));
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The atan() function returns the arc tangent of arg as a numeric value between -Pi/2 and Pi/2 radians.
- What will be the output of the following PHP code?
<?php
echo ord ("Rahul");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The ord() function returns the ASCII value of the first character of a string. The ASCII value of R is 82, thus 82 was displayed.
- What will be the output of the following PHP code?
<?php
echo chr(51);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The chr() function returns a character from the specified ASCII value. Since the ASCII value of 3 is 51, thus 3 was displayed.
- What will be the output of the following PHP code?
<?php
function fun($message)
{
echo "$message";
}
$var = "fun";
$var("Executed...");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
It is possible to call a function using a variable which stores the function name.
- What will be the output of the following PHP code?
<?php
$option2 = "Hey";
function fun($option1)
{
echo $option1;
echo $option2;
}
fun("Welcome");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
If you want to put some variables in function that was not passed by it, you must use “global”. Inside the function type global $option2.