private function urlEncodeAll($string)
    {
        $encoded = '';
        for ($i = 0; isset($string[$i]); $i++) {
            $character = $string[$i];
            if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
                $character = '%' . sprintf('%02X', ord($character));
            }
            $encoded .= $character;
        }

        return $encoded;
    }
private function urlEncodeAll($string)
    {
        $encoded = '';
        for ($i = 0; isset($string[$i]); $i++) {
            $character = $string[$i];
            if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
                $character = '%' . sprintf('%02X', ord($character));
            }
            $encoded .= $character;
        }

        return $encoded;
    }
private function urlEncodeAll ( $ string ) { $ encoded = '' ; for ( $ i = 0 ; isset ( $ string [ $ i ] ) ; $ i ++ ) { $ character = $ string [ $ i ] ; if ( ! ctype_alnum ( $ character ) && ! in_array ( $ character , array ( '-' , '_' ) , true ) ) { $ character = '%' . sprintf ( '%02X' , ord ( $ character ) ) ; } $ encoded .= $ character ; } return $ encoded ; }
Urlencode all non alphanumeric characters. rawurlencode() can not be used as it does not encode `.`

@param  string $string
@return string
Urlencode all non alphanumeric characters . rawurlencode () can not be used as it does not encode .