Re: Converting a string into ASCII and a bit more - newbie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux