Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-24 Thread John Hicks

Ahmed Saad wrote:

On 23/06/06, cajbecu [EMAIL PROTECTED] wrote:


  $data .= #.ord(substr($string,$i,1)).;;


and I think there's no need for substr.. just

$data .= #.$string[$i].;;


/ahmed



And, for the record, you are not converting a string to ASCII, rather an 
ASCII string to its decimal equivalent.


-J

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



[PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread Juanjo Pascual

Do you know any way to convert any string to ascii characters??

I mean:


*abcdefgh*

to

*#97;#98;#99;#100;#101;#102;#103;#104*


Juanjo.


Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread cajbecu
function stransform($string) {
for ($i=0;$ilength($string);$i++) {
$data .= #.ord(substr($string,$i,1)).;;
}
return $data;
}


Juanjo Pascual wrote:
 Do you know any way to convert any string to ascii characters??
 
 I mean:
 
 
 *abcdefgh*
 
 to
 
 *#97;#98;#99;#100;#101;#102;#103;#104*
 
 
 Juanjo.
 

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



Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread Juanjo Pascual

Ok. Thanks.

You only have to change the function *length() *by the function *strlen()*


cajbecu escribió:

function stransform($string) {
for ($i=0;$ilength($string);$i++) {
$data .= #.ord(substr($string,$i,1)).;;
}
return $data;
}


Juanjo Pascual wrote:
  

Do you know any way to convert any string to ascii characters??

I mean:


*abcdefgh*

to

*#97;#98;#99;#100;#101;#102;#103;#104*


Juanjo.





  


Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread cajbecu
That`s true, my mistake.. (length is in pascal)

cheers,

Juanjo Pascual wrote:
 Ok. Thanks.
 
 You only have to change the function *length() *by the function *strlen()*
 
 
 cajbecu escribió:
 function stransform($string) {
  for ($i=0;$ilength($string);$i++) {
  $data .= #.ord(substr($string,$i,1)).;;
  }
 return $data;
 }


 Juanjo Pascual wrote:
   
 Do you know any way to convert any string to ascii characters??

 I mean:


 *abcdefgh*

 to

 *#97;#98;#99;#100;#101;#102;#103;#104*


 Juanjo.

 


   

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



Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread Ahmed Saad

On 23/06/06, cajbecu [EMAIL PROTECTED] wrote:


  $data .= #.ord(substr($string,$i,1)).;;


and I think there's no need for substr.. just

$data .= #.$string[$i].;;


/ahmed

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