PHP - Concatenating 2 objects -


i have 2 objects.

here output of objects when print them out print_r method of php.

oject #1;

stdclass object ( [id] => 1 [portal_id] => 1 [name=> nevzat ) 

object #2;

stdclass object ( [surname] => yilmaz) 

i want concatenate these 2 objects each other @ end of process need object contains of variables of 2 objects;

stdclass object ( [id] => 1 [portal_id] => 1 [name=> nevzat [surname] => yilmaz ) 

a simple way temporarily cast objects arrays, merge arrays, case resulting array stdclass object.

$merged = (object) array_merge((array) $object_a, (array) $object_b); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -