Skip to content

Instantly share code, notes, and snippets.

@kkreft
Created February 27, 2014 13:56
Show Gist options
  • Save kkreft/9250494 to your computer and use it in GitHub Desktop.
Save kkreft/9250494 to your computer and use it in GitHub Desktop.
$obj_merged = (object) array_merge((array) $obj1, (array) $obj2);
@TatwiraT
Copy link

TatwiraT commented Nov 19, 2018

this is true only if the objects are containing only properties, if there are methods they will be removed
u should loop over theme both to preserve all

@mjawaids
Copy link

mjawaids commented Apr 8, 2020

this is true only if the objects are containing only properties, if there are methods they will be removed
u should loop over theme both to preserve all

Any example for copying methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment