note 10286 deleted from bin2hex by jmoore
| From: | jmoore@php.net | Date: | Sun, 24 Dec 2000 13:47:07 +0000 |
| Subject: | note 10286 deleted from bin2hex by jmoore | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9055@lists.php.net to get a copy of this message | ||
This is useful if you want to give parameters to your script via links (and not forms). Then you
need to change some chars into their hex-numbers. E.g. space to %20.
function asc2form ($input) {
$nochange = array
("a","b","c","d","e","f","g",
"h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x","y","z",
"A","B","C","D","E","F","G","H","I","J","K","L","M","N",
"O","P","Q","R","S","T","U","V","W","X","Y","Z",
"0","1","2","3","4","5","6","7","8","9","_","-");
for ($i=0;$i<strlen($input);$i++) {
$char = substr($input,$i,1);
if (in_array($char,$nochange)) {
$ret .= $char;
} else {
$ret .= "%".bin2hex($char);
}
return $ret;
}