What will be the output of the following PHP code ?
<?php
$array = array("red", "green");
array_push($array, "blue", "yellow");
print_r($array);
?>
<?php
$array = array("red", "green");
array_push($array, "blue", "yellow");
print_r($array);
?>
A. Array ( [0] => red [1] => green [2] => blue [3] => yellow )
B. Array ( [0] => blue [1] => yellow [2] => red [3] => green )
C. Array ( [0] => red [1] => green )
D. Array ( [0] => blue [1] => yellow )
Answer: Option A
Solution(By Examveda Team)
The array_push() function inserts one or more elements to the end of an array.Related Questions on Arrays
A. karnataka 11,35,000
B. 11,35,000
C. population 11,35,000
D. karnataka population
Which function will return true if a variable is an array or false if it is not?
A. this_array()
B. is_array()
C. do_array()
D. in_array()
Join The Discussion