PHP - Threaded::merge() 函数



Threaded::merge - 操作

语法

public boolean Threaded::merge( mixed $from [, bool $overwrite ] )

Threaded::merge 函数可以将数据合并到当前对象中。

Threaded::merge 函数可以返回一个布尔值,指示操作是否成功。

示例

<?php
   $array = [];

   while(count($array) < 10)
      $array[] = count($array);

   $stdClass = new stdClass();
   $stdClass->foo = "foo";
   $stdClass->bar = "bar";
   $stdClass->baz = "baz";
   $safe = new Threaded();
   $safe->merge($array);
   $safe->foo = "bar";
   $safe->merge($stdClass, false);

   var_dump($safe);
?>
php_function_reference.htm
广告