Re: Converting a string into ASCII and a bit more - newbie
| From: | Klaus Reimer | Date: | Mon, 15 Nov 2004 07:56:47 +0000 |
| Subject: | Re: Converting a string into ASCII and a bit more - newbie | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202019@lists.php.net to get a copy of this message | ||
Alp wrote:
$x=1
while ($x<=strlen($string)) {
$holder = ord(substr($string, $x, 1));
$result = $result . $holder;
}
and failed since it takes ages to process and does not really return a
proper value/result but repetitive number such as 11111..........
I think you forgot to increment $x. Add an "$x++" at the end of your loop and it works.
And by the way: It's better to write "$result .= $holder" if you want to append a string to another. That's shorter and (more important) faster.