HH\Lib\Keyset\equal
Returns whether the two given keysets have the same elements, using strict equality
namespace HH\Lib\Keyset;
function equal<Tv as arraykey>(
keyset<Tv> $keyset1,
keyset<Tv> $keyset2,
): bool;
To guarantee equality of order as well as contents, use ===
.
Time complexity: O(n) Space complexity: O(1)
Parameters
keyset<Tv> $keyset1
keyset<Tv> $keyset2
Returns
bool
Examples
$result = Keyset\equal(keyset[1,2,3,4], keyset[1,2,3,4]);
print_r($result);
//result: true
$result = Keyset\equal(keyset[1,2,3,4], keyset[4,2,3,1]);
print_r($result);
//result: true
$result = Keyset\equal(keyset[1,2,3,4], keyset[1,2,3,4,5]);
print_r($result);
//result: false