note 10287 deleted from bin2hex by jmoore

From: Date: Sun, 24 Dec 2000 13:47:24 +0000
Subject: note 10287 deleted from bin2hex by jmoore
Groups: php.notes 
Request: Send a blank email to php-notes+get-9056@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; }

« previous php.notes (#9056) next »