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


PHP CMap::equals方法代码示例

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


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

示例1: testToPArray

 public function testToPArray()
 {
     $map = m(["one" => "a", "two" => "b", "three" => "c"]);
     $map = $map->toPArray();
     $this->assertTrue(CMap::equals($map, ["one" => "a", "two" => "b", "three" => "c"]));
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:6,代码来源:CMapObjectTest.php

示例2: equals

 /**
  * Determines if a map is equal to another map.
  *
  * For any two maps to be equal, they need to have the same key-value pairs.
  *
  * You can use your own comparator for the comparison of the values in the maps, but the default comparator has got
  * you covered when comparing scalar values, such as `string`, `int`, `float`, and `bool`. And the default
  * comparator is smart enough to know how to compare objects of those classes that conform to the IEquality or
  * IEqualityAndOrder interface (static or not), including CUStringObject, CArrayObject, CMapObject, CTime etc. See
  * the [CComparator](CComparator.html) class for more on this.
  *
  * @param  map $toMap The second map for comparison.
  * @param  callable $comparator **OPTIONAL. Default is** `CComparator::EQUALITY`. The function or method to be
  * used for the comparison of any two values. If this parameter is provided, the comparator should take two
  * parameters, with the first parameter being a value from *this* map and the second parameter being a value from
  * the second map, and return `true` if the two values are equal and `false` otherwise.
  *
  * @return bool `true` if the two maps are equal, `false` otherwise.
  *
  * @link   CComparator.html CComparator
  */
 public function equals($toMap, $comparator = CComparator::EQUALITY)
 {
     return CMap::equals($this->m_map, $toMap, $comparator);
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:25,代码来源:CMapObject.php

示例3: testInsertValue

 public function testInsertValue()
 {
     $map = ["one" => "a", "two" => "b", "three" => "c"];
     CMap::insertValue($map, "d");
     $this->assertTrue(CMap::equals($map, ["one" => "a", "two" => "b", "three" => "c", 0 => "d"]));
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:6,代码来源:CMapTest.php


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