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

Wierd echo error?
Hi, i got the most wierd php error ever and i don't know why..
Code: echo "<t

Something like an INI editor or a DelimitedText-Editor
Hi all,

Am very, very, very new to PHP and not sure if I should be posting this to a Javascri

Just wondering what you think about my site
I am new to phpfreaks i just seen this form and thought it would be cool to see what other thought a

Retreiving objects from Sessions
Hi all,

I am getting really frustrated with storing and retreiving objects from a session. Bu

How to validate from 2 possible answers
Hi

I hope somebody can help me with what will probably be really simple, I'm pulling my hair

session variables not working anymore
hello,
i use sessions to handle authentication within my site. my host has been changing a lot of

login to other site by sending post variables
hey,

here is my problem: my school gave me a mail account for school-stuff use. they mail us

reorder sql query
ok so i have this very simple code:
Code: $query = "SELECT search_keywords, COUNT(search_key

How to make a input/output field with multiple lines
Hello.
I put a input/output field on the screen but I could not change height of it. I need to

storing video files into mysql in php
hi

i have my video files in my folder ,
i have to store the path of the videos into db an

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