How to combine two array in php?

In this post, The array_combine() is an inbuilt function in PHP which is used to combine two arrays and create a new array by using one array for keys and another array for values.

1. Code:

<?php
function combineTwoArray($array1, $array2){
	$arrCombine = array_combine($array1,$array2);
    return $arrCombine;
} 
    $fname=array("Bca","B.com","Bsc");
    $age=array("35","37","43");

    print_r(combineTwoArray($fname, $age));
?>

2. Example:

Input:

$fname=array("Bca","B.com","Bsc");
$age=array("35","37","43");

Output:

Array ( [Bca] => 35 [B.com] => 37 [Bsc] => 43 )