41. What will be the output of the following PHP code?
<?php
$fruits = array ("apple", "mango", "peach", "pear", "orange");
$subset = array_splice ($fruits, 2);
print_r ($fruits);
?>
<?php
$fruits = array ("apple", "mango", "peach", "pear", "orange");
$subset = array_splice ($fruits, 2);
print_r ($fruits);
?>
42. What will be the output of the following PHP code?
<?php
$number = array ("4", "hello", 2);
echo (array_sum ($number));
?>
<?php
$number = array ("4", "hello", 2);
echo (array_sum ($number));
?>
43. What will be the output of the following PHP code?
<?php
$array1 = array ("KA", "LA", "CA", "MA", "TA");
$array2 = array ("KA", "IA", "CA", "GA", "TA");
$inter = array_intersect ($array1, $array2);
print_r ($inter);
?>
<?php
$array1 = array ("KA", "LA", "CA", "MA", "TA");
$array2 = array ("KA", "IA", "CA", "GA", "TA");
$inter = array_intersect ($array1, $array2);
print_r ($inter);
?>
44. Array values are keyed by ______ values (called indexed arrays) or using ______ values (called associative arrays). Of course, these key methods can be combined as well.
45. What will the following script output?
<?php
$array = array (1, 2, 3, 5, 8, 13, 21, 34, 55);
$sum = 0;
for ($i = 0; $i < 5; $i++) {
$sum += $array[$array[$i]];
}
echo $sum;
?>
<?php
$array = array (1, 2, 3, 5, 8, 13, 21, 34, 55);
$sum = 0;
for ($i = 0; $i < 5; $i++) {
$sum += $array[$array[$i]];
}
echo $sum;
?>
46. What elements will the following script output?
<?php
$array = array (true => 'a', 1 => 'b');
var_dump ($array);
?>
<?php
$array = array (true => 'a', 1 => 'b');
var_dump ($array);
?>