HH\Lib\Str\compare

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

This function is available as Str\compare() in Facebook's www repository.

Returns < 0 if $string1 is less than $string2, > 0 if $string1 is greater than $string2, and 0 if they are equal

namespace HH\Lib\Str;

function compare(
  string $string1,
  string $string2,
): int;

For a case-insensitive comparison, see Str\compare_ci().

Parameters

  • string $string1
  • string $string2

Returns

  • int