By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,650 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,650 IT Pros & Developers. It's quick & easy.

Variable Types question

P: n/a

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
Share this Question
Share on Google+
1 Reply


P: n/a

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 discussion thread is closed

Replies have been disabled for this discussion.