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
- 608 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
Object-Oriented
Performacne Test
Trac
Unix
Web Service
NuSOAP
PHP Clases
Folder
PHP over Jsp
mysqldump
Netbeans
.NET
Projet Management
Ubuntu
Drupal Themes
x-send
Mobile web
Ubuntu 9.10
Perl
Ruby on Rails
MSN
Perl Module
MySQL
Wikipedia
Dual Boot
PHP vs Jsp
Workflow
JSP
Webservice
Drupal
Apple
Facebook
PHP
Perl Funciton
Pidgin
Gmail
Opera mini
Yahoo
NuSOPA
OOP
Drupal Modules
PHP JSP Performance
Zend Studio for Eclipse
Mac OS X
Leopard
Video Module
PHP functions
Wiki
ASP .NET
Thread
