check if string contain only a-z/A-Z


Posted on 16th Feb 2014 07:03 pm by admin

Is where any way to check if string contains only a-z/A-Z, without writing an array with all possible letters and then looping it.

Code:
$available = array('a', 'b', 'c, 'd'); //write a-z

for ($i = 0; $i <= count($available); $i++)
{
$string = str_replace($available[$i], "", $string);
}

if ($string != "")
{
print "Illegal character.";
}

No comments posted yet

Your Answer:

Login to answer
177 Like 41 Dislike
Previous forums Next forums
Other forums

Sql and php order list script problems
Hi im having a few problems with trying to get the coding right on a orders list ive done (or trying

Why will this program not run if the variables are not global?
Hey guys I have a kind of perplexing situation that is probably simple, but I can't seem to understa

insert mysql embeded videos as blobs?
Using TinyMCE my client will be able to embed images and flash videos into large columns of text whi

text box alphanumeric caracters only
hi all!

I have search on google on how to enter in a test box only caracters A-Z,a-z,0-9 usi

Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the

Sending CC Info by email
I am a little bit less knowledgable in the security area as most developers and I know I have a lot

include function being weird?
I have a very simple system to grab an IP outputted by a PHP file.. (for a project I have) but it ou

Am I setting up my sites oldschool?
Ok,

When I create a site I open a basic template that I have created that consists of a css f

sql error
I have been looking at this code for 20mins and can't work out what I am doing wrong. There is somet

Insert to MySQL inside foreach
Hey.
I am parsing some html, and putting inside an html db.
I need to create a randomized inte

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash