Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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"
]
Comment

php combine arrays

$output = array_merge($array1, $array2);
Comment

php combine values of two arrays

$all_arrays = array_merge($array1, $array2, $array3, ...);
Comment

merge array in php

$a1=array("red","green");
$a2=array("blue","green","yellow");
print_r(array_merge($a1,$a2));
Comment

php array merge

<?php
$array1 = array("color" => "red", 2, 4);
$array2 = array("a", "b", "color" => "green", "shape" => "trapezoid", 4);
$result = array_merge($array1, $array2);
print_r($result);
?>
Array
(
    [color] => green
    [0] => 2
    [1] => 4
    [2] => a
    [3] => b
    [shape] => trapezoid
    [4] => 4
)
Comment

PREVIOUS NEXT
Code Example
Php :: php sort array of array by key 
Php :: laravel translate 
Php :: php check if headers already sent 
Php :: array_push in php 
Php :: php validate date format yyyy-mm-dd 
Php :: 18 year back date in php 
Php :: db raw update laravel 
Php :: print try catche errors 
Php :: database collection to array 
Php :: first name of string php 
Php :: php array map cast to int 
Php :: csrf token mismatch laravel 
Php :: replace multiple characters one string php 
Php :: laravel collection transform 
Php :: eloquent with 
Php :: set names utf8 
Php :: store image in storage laravel 
Php :: codeigniter 3 send email smtp 
Php :: Carbon fomart date 
Php :: create listener using laravel 
Php :: take and skip in laravel 
Php :: angular post phph 
Php :: Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes 
Php :: laravel socialite 
Php :: page break in dompdf 
Php :: default value date symfony entity 
Php :: php destroy session after some time 
Php :: Laravel eloquent get data without duplicates 
Php :: php binary to base64 
Php :: how to use stored procedure in laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =