PHP array_combine()

array_combine() is used to create a combined array from two arrays having an equal number of elements. Elements in one array become keys and elements of another array become values of the new combined array.

For example: Take two arrays having equal no of elements

<?php 
$keys = ['car','book','weapon','ocean']; // 1st array having 4 values 
$values = ['BMW','Let US C','Gun','Indian Ocean']; //2nd array having 4 values 
$combined = array_combine($keys,$values); 
print_r($combined); 
?>

The OutPut of This this code snippet is :

Array
(
    [car] => BMW
    [book] => Let US C
    [weapon] => Gun
    [ocean] => Indian Ocean
)

Run the above code and check the result.

Your Result displays here
Memory: Memory Usage, CPU Time: CPU Usage