Re: [PHP3] Removing ontrol characters
| From: | (Richard Lynch) | Date: | Fri, 30 Jun 2000 18:17:05 +0000 |
| Subject: | Re: [PHP3] Removing ontrol characters | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4086@lists.php.net to get a copy of this message | ||
In article <394D6BA4.3CA47A0@capecod.net>, cwieden@capecod.net (Clif
Wieden) wrote:
> Is there a way in PHP to remove all control characters from a string? In
> particular line feeds, carriage returns, etc.
There's probably a faster regex way, but...
function stripcontrol($string){
$result = '';
for ($i = 0; $i < strlen($string); $i++){
if (ord($string[$i]) > 31){
$result .= $string[$i];
}
}
return $result;
}
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)