Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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);
Comment

PREVIOUS NEXT
Code Example
Php :: grouping routes based on controller 
Php :: how to build laravel database 
Php :: update profile method in laravel 
Php :: laravel unique validation on multiple columns 
Php :: laravel pagination layout issue 
Php :: wp_cache_get 
Php :: spatie laravel activity log 
Php :: CSV File Read using PHP fgetcsv() 
Php :: wp image size names 
Php :: increase php_values 
Php :: php for next loop step 
Php :: check if array is empty php 
Php :: php print datetime 
Php :: php time() 
Php :: how to read from temp files php 
Php :: wordpress is_tag function 
Php :: same column in and where laravel query 
Php :: pdf watermark dengan laravel 
Php :: location php ini mac os 
Php :: how to check if all values in an array are equal php 
Php :: php named parameters 
Php :: laravel DB wherein 
Php :: Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead. 
Php :: create custom header in wordpress 
Php :: @lang laravel blade 
Php :: php lowercase function 
Php :: update codeigniter 
Php :: $loop laravel list 
Php :: laravel blade @auth 
Php :: htaccess redirect https laravel 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =