note 72145 deleted from function.chr by danbrown

From: Date: Wed, 15 Sep 2010 21:09:33 +0000
Subject: note 72145 deleted from function.chr by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172590@lists.php.net to get a copy of this message
Note Submitter: lawright at mac dot com ---- A little modification of the really useful onlyreadables function posted by jgraef below that saves some of the common characters.. function onlyreadables($string) { for ($i=0;$i<strlen($string);$i++) { $chr = $string{$i}; $ord = ord($chr); if ($ord>32 and $ord<126) continue; elseif ($ord>191 and $ord<198) $string{$i} = 'A'; elseif ($ord>199 and $ord<204) $string{$i} = 'E'; elseif ($ord>203 and $ord<208) $string{$i} = 'I'; elseif ($ord>209 and $ord<215) $string{$i} = 'O'; elseif ($ord>216 and $ord<221) $string{$i} = 'U'; elseif ($ord>223 and $ord<230) $string{$i} = 'a'; elseif ($ord>231 and $ord<236) $string{$i} = 'e'; elseif ($ord>235 and $ord<240) $string{$i} = 'i'; elseif ($ord>241 and $ord<247) $string{$i} = 'o'; elseif ($ord>249 and $ord<253) $string{$i} = 'u'; elseif ($ord>252 and $ord<256) $string{$i} = 'y'; elseif ($ord==241) $string{$i} = 'n'; elseif ($ord==209) $string{$i} = 'N'; else $string{$i} = '.'; } return $string; }

« previous php.notes (#172590) next »