Examveda
Examveda

What will be the output of the following PHP code?
<?php
$fname = array("Peter", "Ben", "Joe");
$age = array("35", "37", "43");
$c = array_combine($fname, $age);
print_r($c);
?>

A. Array ( Peter Ben Joe )

B. Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )

C. Array ( 35 37 43 )

D. Array ( “[Peter] => 35” “[Ben] => 37” “[Joe] => 43” )

Answer: Option B

Solution(By Examveda Team)

The array_combine() function creates an array by using the elements from one “keys” array and one “values” array.

This Question Belongs to PHP >> Arrays

Join The Discussion

Related Questions on Arrays