Answers for "merge key value array php"

PHP
5

php combine arrays

$output = array_merge($array1, $array2);
Posted by: Guest on June-03-2020
0

merge two arrays one as key to another php

// two arrays one become keys and second becomes values
array_combine ( array $keys , array $values );
Posted by: Guest on November-02-2020
0

associative array in php have same value join them

<?php
$a = array('green', 'red', 'yellow');
$b = array('avocado', 'apple', 'banana');
$c = array_combine($a, $b);

print_r($c);
?>
Posted by: Guest on October-24-2020
0

array merge with same key in php

Input : $a1=array("a"=>"raj", "b"=>"striver");
        $a2=array("z"=>"geeks", "b"=>"articles");
Output : 
Array
(
    [a] => raj
    [b] => Array
        (
            [0] => striver
            [1] => articles
        )

    [z] => geeks
)
Posted by: Guest on April-28-2020

Browse Popular Code Answers by Language