Converting a string into ASCII and a bit more - newbie

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

 



Hi,

My question could have quite stright forward answer or the question itself
might be silly but being a newbie, I'll ask it anyway.
 First I am trying to convert each character in a string into their
respective ASCII codes and then keep these again in a string. Such as:
string : ABCDEFGHIJ, expect to see in the result : 65666768697071727374
Then I would like to further manipulate this result with some math, say add
10 to each pair (the ascii code) so the new result becomes:
75767778798081828384
For my first attempt I tried:
$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 have also tried a 'for' example I found which failed as well.
I truely hope an expert here could show me some light and point me in the
right direction.
I have 2 sets installed on my PC as PHPDEV423 and XAMPP 1.4.9 (set to use
php4) and it fails in both.

Thanks in advance,

Alp
P.S.: I hope I have posted this in the correct NG

-- 
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