當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。