Functions - Study Mode

[#71] What will be the output of the following PHP code? <?php echo ord ( "hi" )
?>
Correct Answer

(C) 104
(G) 104

Explanation

Solution: The ord() function returns the ASCII value of the first character of a string. The ASCII value of h is 104, thus 104 was displayed.

[#72] What will be the output of the following PHP code? <?php echo ( atan ( 0.50 ))
?>
Correct Answer

(C) 0.46364760900081

Explanation

Solution: The atan() function returns the arc tangent of arg as a numeric value between -Pi/2 and Pi/2 radians.

[#73] What will be the output of the following PHP code? <?php define ( "GREETING" , "Hello you! How are you today?" )
echo constant ( "GREETING" )
?>
Correct Answer

(A) Hello you! How are you today?

Explanation

Solution: The define() function defines a constant.

[#74] What will be the output of the following PHP code? <?php define ( "GREETING1" , "Hello you! How are you today?" )
define ( "GREETING2" , "Hello you! How are you today?" )
define ( "GREETING3" , "Hello you! How are you today?" )
echo defined ( "GREETING" )
?>
Correct Answer

(B) 0

Explanation

Solution: The defined() function checks whether a constant exists.

[#75] Which one of the following PHP functions can be used to build a function that accepts any number of arguments?
Correct Answer

(B) func_get_argc()

Explanation

Solution: Here is an example- <?php function foo () { $args = func_get_args()
foreach ( $args as $k => $v ) { echo "arg" .( $k + 1 ). ": $vn"
} } foo ()
/* will print nothing */ foo ( "Hello" )
/* will print Hello */ foo ( "Hello" , "World" , "Bye" )
/* will print Hello World Bye */ ?>