public static function merge_objects($o1, $o2){
    $args = \func_get_args();
    /* @todo check if it's working with more than 2 object arguments */
    if ( \count($args) > 2 ){
      for ( $i = \count($args) - 1; $i > 1; $i-- ){
        $args[$i-1] = self::merge_arrays($args[$i-1], $args[$i]);
      }
      $o2 = $args[1];
    }
    $a1 = self::to_array($o1);
    $a2 = self::to_array($o2);
    $res = self::merge_arrays($a1, $a2);
    return self::to_object($res);
  }
public static function merge_objects($o1, $o2){
    $args = \func_get_args();
    /* @todo check if it's working with more than 2 object arguments */
    if ( \count($args) > 2 ){
      for ( $i = \count($args) - 1; $i > 1; $i-- ){
        $args[$i-1] = self::merge_arrays($args[$i-1], $args[$i]);
      }
      $o2 = $args[1];
    }
    $a1 = self::to_array($o1);
    $a2 = self::to_array($o2);
    $res = self::merge_arrays($a1, $a2);
    return self::to_object($res);
  }
public static function merge_objects ( $ o1 , $ o2 ) { $ args = \ func_get_args ( ) ; /* @todo check if it's working with more than 2 object arguments */ if ( \ count ( $ args ) > 2 ) { for ( $ i = \ count ( $ args ) - 1 ; $ i > 1 ; $ i -- ) { $ args [ $ i - 1 ] = self :: merge_arrays ( $ args [ $ i - 1 ] , $ args [ $ i ] ) ; } $ o2 = $ args [ 1 ] ; } $ a1 = self :: to_array ( $ o1 ) ; $ a2 = self :: to_array ( $ o2 ) ; $ res = self :: merge_arrays ( $ a1 , $ a2 ) ; return self :: to_object ( $ res ) ; }
Returns to a merged object from two objects.

```php
class A {
public $a = 10;
public $b = 20;
};

class B {
public $c = 30;
public $d = 40;
};

$obj1 = new A;
$obj2 = new B;

\bbn\x::merge_objects($obj1, $obj2);
// object {'a': 10, 'b': 20, 'c': 30, 'd': 40}
```

@param object $o1 The first object to merge.
@param object $o2 The second object to merge.
@return object The merged object.
Returns to a merged object from two objects .