What will be the output of the following PHP code? <?php $cars = array("Volvo", "BMW", "Toyota"); echo "I like " . ...
View QuestionWhich function returns an array consisting of associative key/value pairs?
a) count() b) array_count() c) array_count_values() d) count_values() Answer: c Explanation: The function array_count_values() will count all ...
View Question
What will be the output of the following PHP code?
<?php
$fruits = array (“apple”, “orange”, array (“pear”, “mango”),
“banana”);
echo (count($fruits, 1));
?>
What will be the output of the following PHP code? <?php $fruits ...
View QuestionWhich of the following function is used to get the value of the previous element in an array?
a) last() b) before() c) prev() d) previous() Answer: c Explanation: The prev() function returns the previous element in ...
View Question
What will be the output of the following PHP code?
<?php
$fruits = array (“apple”, “orange”, “banana”);
echo (next($fruits));
echo (next($fruits));
?>
What will be the output of the following PHP code? <?php $fruits ...
View Question
What will be the output of the following PHP code?
<?php
$state = array (“Karnataka”, “Goa”, “Tamil Nadu”,
“Andhra Pradesh”);
echo (array_search (“Tamil Nadu”, $state) );
?>
What will be the output of the following PHP code? <?php $state ...
View QuestionWhich in-built function will add a value to the end of an array?
a) array_unshift() b) into_array() c) inend_array() d) array_push() Answer: d Explanation: array_push adds a value to the end ...
View QuestionWhich of the following PHP function will return true if a variable is an array or false if it is not an array?
a) this_array() b) is_array() c) do_array() d) in_array() Answer: b Explanation: The function is_array() is an inbuilt ...
View Question
What will be the output of the following PHP code?
<?php
$states = array(“Karnataka” => array
(“population” => “11,35,000”, “capital” => “Bangalore”),
“Tamil Nadu” => array( “population” => “17,90,000”,
“capital” => “Chennai”) );
echo $states[“Karnataka”][“population”];
?>
What will be the output of the following PHP code? <?php $states ...
View Question
Which of the following are correct ways of creating an array?
i) state[0] = “karnataka”;
ii) $state[] = array(“karnataka”);
iii) $state[0] = “karnataka”;
iv) $state = array(“karnataka”);
Which of the following are correct ways of creating an array? i) state[0] = "karnataka"; ii) $state[] = array("karnataka"); iii) $state[0] ...
View Question