473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
Mar 24 '08 #1
2 3387
*** Aaron Gray escribió/wrote (Mon, 24 Mar 2008 20:50:18 -0000):
$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.

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
--
Mar 24 '08 #2
"Álvaro G. Vicario" <we*******************@demogracia.comwrote in message
news:16******************************@40tude.net.. .
*** Aaron Gray escribió/wrote (Mon, 24 Mar 2008 20:50:18 -0000):
>$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.
>how do I get the value 65 from $ch as an integer ?

ord()
Great, thanks alot,

Aaron
Mar 24 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dan | last post by:
Some knows how to verify an ascii code. I want to verify a char for the list of ascii codes between 64 to 122. Mainly in other words, check a char, look if its in a range of ascii code and output...
6
by: Haas | last post by:
Hello folks, I just started a C++ course. An exercise is to give the ASCII value of a character read from keyboard. I place the input from the keyboard in a char-variable. How can i get the...
12
by: wob | last post by:
Hi there, I wish to show some special characters such as the char for "alpha" and the symbol for degrees.. Anyone please give me some suggestions how to do that? Thank you very much! Owen
1
by: James Dean | last post by:
i want to be able to get the correct ascii value from a byte without having to use the Convert.ToChar function as a char takes up two bytes of space and it is affecting the performance of my...
3
by: Director - Minvent | last post by:
Hi, I am reading from a serial port from a device which sends over an ascii character. It uses the full extended 256 character set and therefore has non-printing characters too. So what i want...
0
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
6
by: ssetz | last post by:
Hello, For work, I need to write a password filter. The problem is that my C+ + experience is only some practice in school, 10 years ago. I now develop in C# which is completely different to me....
4
by: meendar | last post by:
Hi, I am having a character pointer which contains ascii values. i just want to convert all these ascii values to respective characters and again store it in another character pointer. ...
9
by: =?Utf-8?B?RGFu?= | last post by:
I have the following code section that I thought would strip out all the non-ascii characters from a string after decoding it. Unfortunately the non-ascii characters are still in the string....
18
by: nar0122 | last post by:
//Nicholas Riseden //CSCI 3300 //Assignment 4 Version 2 #include "tree.h" #include "pqueue.h" #include <string> #include <fstream> #include <iostream> #include <stdio.h>
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.