WordPress at Your Fingertips
function is not described

ParagonIE_Sodium_Compat::increment() public WP 1.0

Increase a string (little endian)

{} It's a method of the class: ParagonIE_Sodium_Compat{}

No Hooks.

Return

null. Nothing.

Usage

$result = ParagonIE_Sodium_Compat::increment( $var );
$var(string) (required) (passed by reference — &)
-

Code of ParagonIE_Sodium_Compat::increment() WP 5.8.2

public static function increment(&$var)
{
    /* Type checks: */
    ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1);

    if (self::useNewSodiumAPI()) {
        sodium_increment($var);
        return;
    }
    if (self::use_fallback('increment')) {
        $func = '\\Sodium\\increment';
        $func($var);
        return;
    }

    $len = ParagonIE_Sodium_Core_Util::strlen($var);
    $c = 1;
    $copy = '';
    for ($i = 0; $i < $len; ++$i) {
        $c += ParagonIE_Sodium_Core_Util::chrToInt(
            ParagonIE_Sodium_Core_Util::substr($var, $i, 1)
        );
        $copy .= ParagonIE_Sodium_Core_Util::intToChr($c);
        $c >>= 8;
    }
    $var = $copy;
}