Re: [PHP-DEV] adding objects with + equal to array process From: waldschrott (waldschrott <email protected>)
Date: 07/05/00

> $obj1 = new Schrott;
> $obj2 = new Schrott;
>
> add_schrotts( $obj1, $obj2 );

I´m using the function below already, but it does not perform very well
on large object. I only use it for objects of 'StdClass' created with
settype() and I´m now playing around with create_function() to speed it
up, but it would be consequent if we´d make it possible to "add" objects
(perhaps only StdClass allowed) with the "+" operator, the array
"adding" is very useful too...

function &merge_objects(&$obj,&$obj2) {
$vars=get_object_vars($obj2);
foreach($vars AS $key => $value) {
$obj->$key=$value; } }
regards

-- 
o----------0-¬---------O-·---¬----o---®-----o o    O   °       .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0  O °     ¤  °        ·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ ° o © °   .  ·
| psychedelic experience |  gott <email protected>  | O   ° o           °
o-¬--o--0-----©-·--O-----o-----0-¤----------o  0 °  · °  .  ¤ ·

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>