php merge 2 arrays
<?php $array1 = [ "color" => "green" ]; $array2 = [ "color" => "red", "color" => "blue" ]; $result = array_merge($array1, $array2); ?> // $result [ "color" => "green" "color" => "red", "color" => "blue" ]
php merge 2 arrays
<?php $array1 = [ "color" => "green" ]; $array2 = [ "color" => "red", "color" => "blue" ]; $result = array_merge($array1, $array2); ?> // $result [ "color" => "green" "color" => "red", "color" => "blue" ]
php array merge for associative arrays
<?php $array1 = array('key1' => 'test1', 'key2' => 'test2'); $array2 = array('key3' => 'test3', 'key4' => 'test4'); $resultArray = array_merge($array1, $array2); // If you have numeric or numeric like keys, array_merge will // reset the keys to 0 and start numbering from there $resultArray = $array1 + $array2; // Using the addition operator will allow you to preserve your keys, // however any duplicate keys will be ignored.
array marge in php
<?php $a1=array("red","green"); $a2=array("blue","yellow"); print_r(array_merge($a1,$a2)); ?>
php array merge
array_merge ([ array $... ] ) : array
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us