src/Util/RequestParser.php
public static function parseRequestParams(string $source): array
    {
        // '[' is urlencoded ('%5B') in the input, but we must urldecode it in order
        // to find it when replacing names with the regexp below.
        $source = str_replace('%5B', '[', $source);

        $source = preg_replace_callback(
            '/(^|(?<=&))[^=[&]+/',
            function ($key) {
                return bin2hex(urldecode($key[0]));
            },
            $source
        );

        // parse_str urldecodes both keys and values in resulting array.
        parse_str($source, $params);

        return array_combine(array_map('hex2bin', array_keys($params)), $params);
    }
public static function parseRequestParams(string $source): array
    {
        // '[' is urlencoded ('%5B') in the input, but we must urldecode it in order
        // to find it when replacing names with the regexp below.
        $source = str_replace('%5B', '[', $source);

        $source = preg_replace_callback(
            '/(^|(?<=&))[^=[&]+/',
            function ($key) {
                return bin2hex(urldecode($key[0]));
            },
            $source
        );

        // parse_str urldecodes both keys and values in resulting array.
        parse_str($source, $params);

        return array_combine(array_map('hex2bin', array_keys($params)), $params);
    }
public static function parseRequestParams ( string $ source ) : array { // '[' is urlencoded ('%5B') in the input, but we must urldecode it in order // to find it when replacing names with the regexp below. $ source = str_replace ( '%5B' , '[' , $ source ) ; $ source = preg_replace_callback ( '/(^|(?<=&))[^=[&]+/' , function ( $ key ) { return bin2hex ( urldecode ( $ key [ 0 ] ) ) ; } , $ source ) ; // parse_str urldecodes both keys and values in resulting array. parse_str ( $ source , $ params ) ; return array_combine ( array_map ( 'hex2bin' , array_keys ( $ params ) ) , $ params ) ; }
Parses request parameters from the specified source.

@author Rok Kralj

@see https://stackoverflow.com/a/18209799/1529493
Parses request parameters from the specified source .