Requires the Hack Standard Library to be installed.
Facebook Engineer?

This function is available as Dict\equal() in Facebook's www repository.

Returns whether the two given dicts have the same entries, using strict equality

namespace HH\Lib\Dict;

function equal<Tk as arraykey, Tv>(
  dict<Tk, Tv> $dict1,
  dict<Tk, Tv> $dict2,
): bool;

To guarantee equality of order as well as contents, use ===.

Time complexity: O(n) Space complexity: O(1)


  • dict<Tk, Tv> $dict1
  • dict<Tk, Tv> $dict2


  • bool