Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 24th, 2008, 09:55 PM
Aaron Gray
Guest
 
Posts: n/a
Default Getting ascii value of a char

Given :-

$text="abc";

$ch = $text{0}; // index character 0 in $text

how do I get the value 65 from $ch as an integer ?

Many thanks in advance,

Aaron


  #2  
Old March 24th, 2008, 10:25 PM
=?iso-8859-1?Q?=C1lvaro?= G. Vicario
Guest
 
Posts: n/a
Default Re: Getting ascii value of a char

*** Aaron Gray escribió/wrote (Mon, 24 Mar 2008 20:50:18 -0000):
Quote:
$text="abc";
>
$ch = $text{0}; // index character 0 in $text
You'd better get used to $text[0]. Apparently, the PHP guys will deprecate
the first syntax in PHP 6.

Quote:
how do I get the value 65 from $ch as an integer ?
ord()


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
  #3  
Old March 24th, 2008, 10:55 PM
Aaron Gray
Guest
 
Posts: n/a
Default Re: Getting ascii value of a char

"Álvaro G. Vicario" <webmasterNOSPAMTHANKS@demogracia.comwrote in message
news:16xr3ovmn0j4k$.1ik3o5ph82kjb.dlg@40tude.net.. .
Quote:
*** Aaron Gray escribió/wrote (Mon, 24 Mar 2008 20:50:18 -0000):
Quote:
>$text="abc";
>>
>$ch = $text{0}; // index character 0 in $text
>
You'd better get used to $text[0]. Apparently, the PHP guys will deprecate
the first syntax in PHP 6.
Okay, thanks.
Quote:
Quote:
>how do I get the value 65 from $ch as an integer ?
>
ord()
Great, thanks alot,

Aaron


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles