array combine php code example
Example 1: array_combine function in php
<?php
$fname=array("Peter","Ben","Joe");
$age=array("35","37","43");
$c=array_combine($fname,$age);
print_r($c);
?>
Example 2: php combine arrays
$output = array_merge($array1, $array2);
Example 3: php array merge
array_merge ([ array $... ] ) : array
Example 4: associative array in php have same value join them
<?php
$a = array('green', 'red', 'yellow');
$b = array('avocado', 'apple', 'banana');
$c = array_combine($a, $b);
print_r($c);
?>
Example 5: php combine values of two arrays
$all_arrays = array_merge($array1, $array2, $array3, ...);