merge two objects in php
array_merge((array)json_decode($data1), (array) json_decode($data2));
merge two objects in php
array_merge((array)json_decode($data1), (array) json_decode($data2));
php concat objects
// 1) Copy over the attributes of $obj1 to $obj2:
foreach ( $obj1 as $attr => $value ) {
$obj2->{$attr} = $value;
}
// 2) Cast the objects to arrays, merge those arrays, then cast
// the resulting array back to a stdClass object.
$merged = (object) array_merge((array) $obj1, (array) $obj2);
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