Array Combine Function in PHP
In this article I explain the PHP array_combine function.
Introduction
The array_combine() function creates an array by using one array for keys and another for its value.
Syntax
array_combine (keys, values) |
Parameter in array_combine function
It takes two parameters; they are:
Parameter |
Description |
keys |
It specifying the keys. |
values |
It specifying the values. |
Example of array_combine function
<?php
echo"<pre>";
$Fname=array('Sharad', 'Pramod', 'Sam');
$Lname = array('Gupta', 'Dubey', 'Hobbs');
$Fullname = array_combine($Fname, $Lname);
print_r($Fullname);
?>
Output