array_combine
is a inbuilt Function in PHP .
These function creates an array by using the elements from one keys array
and one values array
.
Example
<?php
$a = array('green', 'red', 'yellow');
$b = array('avocado', 'apple', 'banana');
$c = array_combine($a, $b);
print_r($c);
?>
Result
Array
(
[green] => avocado
[red] => apple
[yellow] => banana
)
Thanks
Top comments (0)