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

how to identify Letter v Number in string

P: n/a
I'm at a pretty early stage of learning php and I'm looking to be able
to examine a string and tell which each character in that string is -
a letter or a number. I've tried php.net but I'm either asking the
wrong questions or I don't understand the answers.
Any help gratefully received.
May 22 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jo*****@hotmail.com wrote:
I'm at a pretty early stage of learning php and I'm looking to be able
to examine a string and tell which each character in that string is -
a letter or a number. I've tried php.net but I'm either asking the
wrong questions or I don't understand the answers.
Any help gratefully received.
ctype_alpha($text); // alphabetic within current locale
ctype_digit($num); // digits 0-9

- --
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <htmlpurifier.org Anti-XSS HTML Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGU0IpqTO+fYacSNoRAmhWAKCCHotagBG4HHOShTm+zN 6CkzxINACfYGKW
2RqstIrlopvptQs00pEsT3k=
=08y1
-----END PGP SIGNATURE-----
May 22 '07 #2

P: n/a
On Tue, 22 May 2007 15:19:05 -0400, "Edward Z. Yang"
<ed*********@thewritingpot.comwrote:
>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jo*****@hotmail.com wrote:
>I'm at a pretty early stage of learning php and I'm looking to be able
to examine a string and tell which each character in that string is -
a letter or a number. I've tried php.net but I'm either asking the
wrong questions or I don't understand the answers.
Any help gratefully received.

ctype_alpha($text); // alphabetic within current locale
ctype_digit($num); // digits 0-9
Thank you, that looks like what I wanted. I'll be checking it out
later on this week, but does the ctype_aplha() identify spaces, too?
May 23 '07 #3

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jo*****@hotmail.com wrote:
Thank you, that looks like what I wanted. I'll be checking it out
later on this week, but does the ctype_aplha() identify spaces, too?
ctype_alpha does not accept spaces.

- --
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <htmlpurifier.org Anti-XSS HTML Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGVLpwqTO+fYacSNoRAtKwAJ94STn300kB/iruGWJ0lrl39SJkkgCeKgIv
l5m3FI7kEuGBkceOSTdTR2Q=
=JryD
-----END PGP SIGNATURE-----
May 23 '07 #4

P: n/a
On Wed, 23 May 2007 18:04:32 -0400, "Edward Z. Yang"
<ed*********@thewritingpot.comwrote:
>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jo*****@hotmail.com wrote:
>Thank you, that looks like what I wanted. I'll be checking it out
later on this week, but does the ctype_aplha() identify spaces, too?

ctype_alpha does not accept spaces.
Boo-hoo. But thank you anyway!
May 24 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.