public function encode($string)
    {
        $ret = '';
        for ($i = 0, $c = strlen($string); $i < $c; $i++) {
            if ($string[$i] !== '%' && !isset($this->preserve[$int = ord($string[$i])])) {
                $ret .= '%' . sprintf('%02X', $int);
            } else {
                $ret .= $string[$i];
            }
        }
        return $ret;
    }
public function encode($string)
    {
        $ret = '';
        for ($i = 0, $c = strlen($string); $i < $c; $i++) {
            if ($string[$i] !== '%' && !isset($this->preserve[$int = ord($string[$i])])) {
                $ret .= '%' . sprintf('%02X', $int);
            } else {
                $ret .= $string[$i];
            }
        }
        return $ret;
    }
public function encode ( $ string ) { $ ret = '' ; for ( $ i = 0 , $ c = strlen ( $ string ) ; $ i < $ c ; $ i ++ ) { if ( $ string [ $ i ] !== '%' && ! isset ( $ this -> preserve [ $ int = ord ( $ string [ $ i ] ) ] ) ) { $ ret .= '%' . sprintf ( '%02X' , $ int ) ; } else { $ ret .= $ string [ $ i ] ; } } return $ ret ; }
Our replacement for urlencode, it encodes all non-reserved characters,
as well as any extra characters that were instructed to be preserved.
@note
Assumes that the string has already been normalized, making any
and all percent escape sequences valid. Percents will not be
re-escaped, regardless of their status in $preserve
@param string $string String to be encoded
@return string Encoded string.
Our replacement for urlencode it encodes all non - reserved characters as well as any extra characters that were instructed to be preserved .