Click to See Complete Forum and Search --> : Two quick questions...


mitya
10-13-2003, 06:07 PM
Hi all

1) How do I check if a variable's value is numerical or alphabetic? (i.e. integer or string)

2) Is there any in-built command for numbering letters? So: a+3 = d, sort of thing? I know there's way round this but I was just wondering if there was a function so that, for example, hex colour values could be changed easily in calculation using the above equation.

Thanks in advance :o)

pyro
10-13-2003, 06:55 PM
1: $str = "17je4";
if (preg_match("/^[a-zA-Z0-9]+$/", $str)) {
echo "The string is alphanumeric";
}
else {
echo "The string is not alphanumeric";
}

2: Not that I know of...

mitya
10-14-2003, 08:03 AM
THanks as always, Pyro

I'll make it my mission to find a programming language you don't know.

pyro
10-14-2003, 09:27 AM
lol... won't be too hard... ;)