note 15860 added to function.rawurlencode
| From: | php at sili dot net | Date: | Fri, 05 Oct 2001 16:51:56 +0000 |
| Subject: | note 15860 added to function.rawurlencode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18606@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!
--
http://www.php.net/manual/en/function.rawurlencode.php
http://master.php.net/manage/user-notes.php?action=edit+15860
http://master.php.net/manage/user-notes.php?action=delete+15860
http://master.php.net/manage/user-notes.php?action=reject+15860