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

This function is available as C\every() in Facebook's www repository.

Returns true if the given predicate returns true for every element of the given Traversable

namespace HH\Lib\C;

function every<T>(
  Traversable<T> $traversable,
  ?(function(T): bool) $predicate = NULL,
): bool;

If no predicate is provided, it defaults to casting the element to bool.

If you're looking for C\all, this is it.

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



  • bool