php / 8.1.5 / function.sodium-compare.html /

sodium_compare

(PHP 7 >= 7.2.0, PHP 8)

sodium_compareCompare large numbers

Description

sodium_compare(string $string1, string $string2): int

Compare two strings as if they were arbitrary-length, unsigned little-endian integers, without side-channel leakage.

Parameters

string1

Left operand

string2

Right operand

Return Values

Returns -1 if string1 is less than string2.

Returns 1 if string1 is greater than string2.

Returns 0 if both strings are equal.

© 1997–2021 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/function.sodium-compare.php