PHP array_combine Function

In this programming tutorial you will learn how to work with the PHP array_combine function, which allows you to combine arrays into a single array.

This function takes two existing arrays and combines them into one array. Note that the first array must contain the key values that you want, while the second array must contain the values.


array_combine(name of the first array(keys), name of the second array(values))

Programming Samples and Usage:



$test = array ("a","b","c");
$test2 = array ("Superman", "Batman", "Sandman");




The above code takes the values in the array $test (representing the keys) and combines them with the values in $test2 (representing the values).

The result is:


array (
[a] => Superman [b] => Batman [c] => Sandman

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye