src/MDUrl/DecodeTrait.php
public function decode($string, $exclude=null)
    {
        if ( !is_string( $exclude) ) {
            $exclude = ';/?:@&=+$,#';
        }

        $cache = $this->getDecodeCache($exclude);

        return preg_replace_callback("/(%[a-f0-9]{2})+/i", function($seq) use(&$cache) {
            $result = '';
            $seq = $seq[0];
            for ($i = 0, $l = strlen($seq); $i < $l; $i += 3) {
                $b1 = intval(substr($seq, $i + 1, 2), 16);

                if ($b1 < 0x80) {
                    $result .= $cache[$b1];
                    continue;
                }
                $result .= chr($b1);
            }
            return $result;
        },$string);
    }
public function decode($string, $exclude=null)
    {
        if ( !is_string( $exclude) ) {
            $exclude = ';/?:@&=+$,#';
        }

        $cache = $this->getDecodeCache($exclude);

        return preg_replace_callback("/(%[a-f0-9]{2})+/i", function($seq) use(&$cache) {
            $result = '';
            $seq = $seq[0];
            for ($i = 0, $l = strlen($seq); $i < $l; $i += 3) {
                $b1 = intval(substr($seq, $i + 1, 2), 16);

                if ($b1 < 0x80) {
                    $result .= $cache[$b1];
                    continue;
                }
                $result .= chr($b1);
            }
            return $result;
        },$string);
    }
public function decode ( $ string , $ exclude = null ) { if ( ! is_string ( $ exclude ) ) { $ exclude = ';/?:@&=+$,#' ; } $ cache = $ this -> getDecodeCache ( $ exclude ) ; return preg_replace_callback ( "/(%[a-f0-9]{2})+/i" , function ( $ seq ) use ( & $ cache ) { $ result = '' ; $ seq = $ seq [ 0 ] ; for ( $ i = 0 , $ l = strlen ( $ seq ) ; $ i < $ l ; $ i += 3 ) { $ b1 = intval ( substr ( $ seq , $ i + 1 , 2 ) , 16 ) ; if ( $ b1 < 0x80 ) { $ result .= $ cache [ $ b1 ] ; continue ; } $ result .= chr ( $ b1 ) ; } return $ result ; } , $ string ) ; }
Decode percent-encoded string.
@param string $string
@param string|null $exclude
@return mixed
Decode percent - encoded string .