note 72145 added to function.chr

From: Date: Thu, 04 Jan 2007 15:39:36 +0000
Subject: note 72145 added to function.chr
Groups: php.notes 
Request: Send a blank email to php-notes+get-121290@lists.php.net to get a copy of this message
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; } ---- Server IP: 64.71.164.2 Probable Submitter: 192.204.29.4 ---- Manual Page -- http://www.php.net/manual/en/function.chr.php Edit -- https://master.php.net/note/edit/72145 Del: integrated -- https://master.php.net/note/delete/72145/integrated Del: useless -- https://master.php.net/note/delete/72145/useless Del: bad code -- https://master.php.net/note/delete/72145/bad+code Del: spam -- https://master.php.net/note/delete/72145/spam Del: non-english -- https://master.php.net/note/delete/72145/non-english Del: in docs -- https://master.php.net/note/delete/72145/in+docs Del: other reasons-- https://master.php.net/note/delete/72145 Reject -- https://master.php.net/note/reject/72145 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#121290) next »