当前位置: 首页>>代码示例>>PHP>>正文


PHP CMbArray::mergeRecursive方法代码示例

本文整理汇总了PHP中CMbArray::mergeRecursive方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbArray::mergeRecursive方法的具体用法?PHP CMbArray::mergeRecursive怎么用?PHP CMbArray::mergeRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMbArray的用法示例。


在下文中一共展示了CMbArray::mergeRecursive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testMergeRecursive

 public function testMergeRecursive()
 {
     $this->assertNull($this->stub->mergeRecursive(null, null));
     $this->assertNull($this->stub->mergeRecursive(array(1), null));
     $array1 = array(0 => "val1");
     $array2 = array(1 => "val2");
     $this->assertNotEmpty($this->stub->mergeRecursive($array1, $array2));
     $this->assertEquals(array(0 => "val1", 1 => "val2"), $this->stub->mergeRecursive($array1, $array2));
     $array1 = array(0 => "val1");
     $array2 = array(1 => "val2", array(2 => "val3", array(3 => "val4")));
     $resArray = array(0 => "val1", 1 => "val2", array(2 => "val3", array(3 => "val4")));
     $this->assertEquals($resArray, $this->stub->mergeRecursive($array1, $array2));
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:13,代码来源:CMbArrayTest.php

示例2: update

 function update($newValues = array(), $keepOld = true)
 {
     $newValues = array_map_recursive('stripslashes', $newValues);
     if ($keepOld) {
         $this->load();
         $newValues = CMbArray::mergeRecursive($this->values, $newValues);
     }
     if (!count($newValues)) {
         if (is_file($this->targetPath)) {
             unlink($this->targetPath);
         }
         return;
     }
     $this->values = $newValues;
     // Throws many E_STRICT errors
     $config = @new Config();
     @$config->parseConfig($this->values, $this->configType, $this->options);
     return @$config->writeConfig($this->targetPath, $this->configType, $this->options);
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:19,代码来源:CMbConfig.class.php

示例3: mergeRecursive

 /**
  * Merge recursively two array
  *
  * @param array $paArray1 First array
  * @param array $paArray2 The array to be merged
  *
  * @return array The merge result
  */
 static function mergeRecursive($paArray1, $paArray2)
 {
     if (!is_array($paArray1) || !is_array($paArray2)) {
         return $paArray2;
     }
     foreach ($paArray2 as $sKey2 => $sValue2) {
         $paArray1[$sKey2] = CMbArray::mergeRecursive(@$paArray1[$sKey2], $sValue2);
     }
     return $paArray1;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:18,代码来源:CMbArray.class.php


注:本文中的CMbArray::mergeRecursive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。