/    Sign up×
Community /Pin to ProfileBookmark

Two quick questions…

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)

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@pyroOct 13.2003 — 1: [code=php]$str = "17je4";
if (preg_match("/^[a-zA-Z0-9]+$/", $str)) {
echo "The string is alphanumeric";
}
else {
echo "The string is not alphanumeric";
}[/code]


2: Not that I know of...
Copy linkTweet thisAlerts:
@mityaauthorOct 14.2003 — THanks as always, Pyro

I'll make it my mission to find a programming language you don't know.
Copy linkTweet thisAlerts:
@pyroOct 14.2003 — lol... won't be too hard... ?
×

Success!

Help @mitya spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...