Converting a string into ASCII and a bit more - newbie

From: Date: Mon, 15 Nov 2004 06:32:12 +0000
Subject: Converting a string into ASCII and a bit more - newbie
Groups: php.general 
Request: Send a blank email to php-general+get-202016@lists.php.net to get a copy of this message
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

« previous php.general (#202016) next »