PHP Programing language

array_combine() Function in PHP
Previous Home Next

array_combine()

The array_combine() function creates an array by using the elements from one "keys" array and one "values" array.

Syntax:
array_combine(keys,values);

In above syntax, "keys" are array of keys and "values" are array of values.

Example:

 

<?php
$fruit_name=array("Apple","Banana","Mango");
$fruit_weight=array("5kg","3kg","10kg");
$Total=array_combine($fruit_name,$fruit_weight);
print_r($Total);
?>

Output:

Array ( [Apple] => 5kg [Banana] => 3kg [Mango] => 10kg )

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: