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



[PHP] String to Ascii

2002-10-31 Thread Ben Chivers
Hi,

I'm wanting to change a character string from text into ascii code.

I tried using the function:

ebcdic2ascii()

only to find out that it isn't supported with the latest versions of php,
only version 3.

I would appreciate any help from anyone with this topic.

--

Many Regards,
Ben Chivers
Super Sites Pro

Get reliable and affordable web hosting from only $2.91pm at Super Hosts
Pro - www.superhostspro.com




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




Re: [PHP] String to Ascii

2002-10-31 Thread Evan Nemerson
ebcdic2ascii() is an Apache-specific function which is available only on 
EBCDIC based operating systems (OS/390, BS2000). -php.net/ebcdic

What kind of text??? Usually, the text is in ASCII? Do you want to convert to 
the actual numerical representation (ie A == 0x41)? If so, you can try 
bin2hex(). if you want it in decimal, prolly hexdec() in a foreach on a 
explode(\r\n, chunk_split($whatever, 2))'d bin2hex() string... I say that 
because I think bindec will convert the whole string at once, not char by 
char...



On Thursday 31 October 2002 04:26 pm, Ben Chivers wrote:
 Hi,

 I'm wanting to change a character string from text into ascii code.

 I tried using the function:

 ebcdic2ascii()

 only to find out that it isn't supported with the latest versions of php,
 only version 3.

 I would appreciate any help from anyone with this topic.

-- 
Often a non-Christian knows something about the earth, the heavens, and the 
other parts of the world, about the motions and orbits of the stars and even 
their sizes and distances,... and this knowledge he holds with certainty from 
reason and experience. It is thus offensive and disgraceful for an unbeliever 
to hear a Christian talk nonsense about such things, claiming that what he is 
saying is based in Scripture. We should do all that we can to avoid such an 
embarrassing situation, which people see as ignorance in the Christian and 
laugh to scorn.

-Saint Augustine


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