Posted by Colin Fine on 10/13/05 22:30
lkrubner@geocities.com wrote:
> Okay, the function doesn't work:
>
> http://www.whatisliberalism.com/pdsFiles/page2533.xml
>
> All the white space got replaced, but the entity that is kill the feed
> is still there.
>
> What is wrong with this function?
>
> function command($string=false) {
> $howMany = strlen($string);
>
> $newString = "";
> for ($i=0; $i < $howMany; $i++) {
> $char = $string[$i];
> $asciiNum = ord($char);
> if ($asciiNum > 32 && $asciiNum < 128) {
> $newString .= $char;
> } else {
> $newString .= "'";
> }
> }
>
> return $newString;
> }
>
I don't know what's wrong with its operation, but you're reinventing the
wheel.
Have a look at http://uk2.php.net/manual/en/function.strtr.php
Colin
Navigation:
[Reply to this message]
|