ParagonIE_Sodium_Core_Util::stringToIntArray

Advertisement

Summery Summery

Turn a string into an array of integers

Syntax Syntax

ParagonIE_Sodium_Core_Util::stringToIntArray( string $string )

Parameters Parameters

$string

(string) (Required)

Return Return

(array<int,) int>

Source Source

File: wp-includes/sodium_compat/src/Core/Util.php

    public static function stringToIntArray($string)
    {
        if (!is_string($string)) {
            throw new TypeError('String expected');
        }
        /**
         * @var array<int, int>
         */
        $values = array_values(
            unpack('C*', $string)
        );
        return $values;
    }

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.