array_combine(): keys of one array and values of another
$input1=array('One','Two','Three','Four','Five');
$input2=array(1,2,3,4,5);
$output=array_combine($input1,$input2);
print_r($output);
Output is here
Array ( [One] => 1 [Two] => 2 [Three] => 3 [Four] => 4 [Five] => 5 )
Syntax
array_combine ($input_array1 ,$input_array2 )
Parameter | DESCRIPTION |
$input_array1 | Required : Input array of which kyes will be retained. |
$input_array2 | Required : Input array of which values will be retained. |
Returns an array with keys of first array and values of second array.
Returns FALSE if both arrays are not having equal number of elements.
← Array REFERENCE Getting keys of an array →
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com