Answers for "mergey two arrays of objects php"

PHP
1

merge two objects in php

array_merge((array)json_decode($data1), (array) json_decode($data2));
Posted by: Guest on April-26-2020
4

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"
]
Posted by: Guest on May-01-2020

Code answers related to "mergey two arrays of objects php"

Browse Popular Code Answers by Language