ParagonIE_Sodium_Compat::compare()public staticWP 1.0

Compare two strings, in constant-time. Compared to memcmp(), compare() is more useful for sorting.

{} Это метод класса: ParagonIE_Sodium_Compat{}

Хуков нет.


int. If < 0 if the left operand is less than the right If = 0 if both strings are equal If > 0 if the right operand is less than the left


$result = ParagonIE_Sodium_Compat::compare( $left, $right );
$left(строка) (обязательный)
The left operand; must be a string
$right(строка) (обязательный)
The right operand; must be a string

Код ParagonIE_Sodium_Compat::compare() WP 6.0.2

public static function compare($left, $right)
    /* Type checks: */
    ParagonIE_Sodium_Core_Util::declareScalarType($left, 'string', 1);
    ParagonIE_Sodium_Core_Util::declareScalarType($right, 'string', 2);

    if (self::useNewSodiumAPI()) {
        return (int) sodium_compare($left, $right);
    if (self::use_fallback('compare')) {
        return (int) call_user_func('\\Sodium\\compare', $left, $right);
    return ParagonIE_Sodium_Core_Util::compare($left, $right);