note 15860 deleted from function.rawurlencode by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 21:26:12 +0000 |
| Subject: | note 15860 deleted from function.rawurlencode by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23444@lists.php.net to get a copy of this message | ||
rawurlencode("Hello World!") gives Hello%20World%21
If you want to encode every character in your string, this'll do it for you:
function fullrawurlencode($string) {
for ($i=0;$i<strlen($string);$i++) {
$newstring .= "%".dechex(ord(substr($string, $i, 1)));
}
return $newstring;
}
fullrawurlencode("Hello World!") gives %48%65%6c%6c%6f%20%57%6f%72%6c%64%21
Both will rawurldecode() to the same Hello World!