Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following PHP code?
<?php
$age = array(“Harry” => “21”, “Ron” => “23”,”Malfoy” => “21”);
array_pop($age);
print_r(array_change_key_case($age, CASE_UPPER));
?>

What will be the output of the following PHP code?
<?php
$age = array(“Harry” => “21”, “Ron” => “23”,”Malfoy” => “21”);
array_pop($age);
print_r(array_change_key_case($age, CASE_UPPER));
?>
a) Array ( [Harry] => 21 [Ron] => 23 [Malfoy] => 21 )
b) Array ( [HARRY] => 21 [RON] => 23 [MALFOY] => 21 )
c) Array ( [HARRY] => 21 [RON] => 23 )
d) Array ( [Harry] => 21 [Ron] => 23 )

Answer: c
Explanation: The function array_pop() will delete the last element of an array. So Malfoy => 21 will be deleted and the function array_change_key_case() will change all keys in an array to lowercase or uppercase.

Join The Discussion