Merging stdClass() objects in php
<?php
$foo1 = new stdClass();
$foo2 = new stdClass();
$foo3 = new stdClass();
$foo1->one = "1";
$foo2->two = "2";
foreach ( $foo1 as $key => $value ) {
$foo3->$key = $value;
}
foreach ( $foo2 as $key => $value ) {
$foo3->$key = $value;
}
var_dump($foo3);
Tags
Links
- heshan's blog
- 614 reads
-
Comments
Submitted by Anonymous (not verified) on Mon, 12/01/2008 - 12:10.
A good one.
Thanks for the info.
Post new comment
Tags in Custom Tags
Thread
Trac
Web Service
Drupal Modules
Wikipedia
Facebook
ASP .NET
Apple
Folder
Perl Module
Ubuntu
x-send
PHP
Unix
NuSOPA
Wiki
Object-Oriented
Webservice
Yahoo
MSN
Mobile web
Performacne Test
Gmail
Leopard
MySQL
PHP Clases
PHP JSP Performance
PHP over Jsp
JSP
Netbeans
Ruby on Rails
OOP
Pidgin
.NET
Workflow
Mac OS X
PHP vs Jsp
Perl Funciton
PHP functions
NuSOAP
Drupal
Projet Management
Zend Studio for Eclipse
Dual Boot
Video Module
Ubuntu 9.10
Perl
Opera mini
mysqldump
Drupal Themes
