473,387 Members | 1,624 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,387 software developers and data experts.

Variable Types question


Does PHP have a byte or character type ?

If I do

$email = "to**@tony.com";
echo $email[0];

I can get the letter "t"

However according to the documentation (and my tests) this is not being
extracted as a character but a string.

How can I extract just the character itself ?

To test this you can do this:

echo ((int)$email[0]);
and it returns 0.
is there a character (byte) type at all ?

tony
Jul 1 '06 #1
1 1051

to**@tony.com wrote:
Does PHP have a byte or character type ?

If I do

$email = "to**@tony.com";
echo $email[0];

I can get the letter "t"

However according to the documentation (and my tests) this is not being
extracted as a character but a string.

How can I extract just the character itself ?
That is the letter itself. What, precisely are you trying to do?
To test this you can do this:

echo ((int)$email[0]);
and it returns 0.


In order to get the numerical value of a character, you need to use the
ord() fuction. <http://www.php.net/ord>

Ken

Jul 1 '06 #2

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

Similar topics

5
by: Dan Williams | last post by:
Hi people I understand that Python is strongly, but also dynamically typed. However, I need to create a variable which initially isn't actually set to anything, but still needs to be of a...
15
by: Jay | last post by:
I'm sure this is a really dumb question, but how do you detect a variable type in Python? For example, I want to know if the variable "a" is a list of strings or a single string. How do I do...
23
by: stewart.midwinter | last post by:
No doubt I've overlooked something obvious, but here goes: Let's say I assign a value to a var, e.g.: myPlace = 'right here' myTime = 'right now' Now let's say I want to print out the two...
7
by: Wessel Troost | last post by:
Hi Group, How can you check if a variable is defined in C#? For example, "string s;" would declare an undefined variable. But how can I check in an "if" statement wether it's defined or not?...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
8
by: Florian Daniel Otel | last post by:
Hello all, As the subject says, I am a newcomer to Python and I have a newcomer question wrt namespaces and variable scope. Obviously, I might be missing smth obvious, so TIA for the patience...
18
by: Jack | last post by:
Thanks.
5
by: Daz | last post by:
Hi everyone. Another simple question which should hopefully warrent a simple answer. I would like a function to be run whenever a variable is updated. I have tried binding the onchange event...
29
by: garyusenet | last post by:
I'm trying to investigate the maximum size of different variable types. I'm using INT as my starting variable for exploration. I know that the maximum number that the int variable can take is:...
38
by: junky_fellow | last post by:
Guys, I was just looking at some code where to initialize an integer with all F's following statement is used; unsigned int i = -1; I want to know if this is the right way of doing the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.