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

Writing to the middle of a file
Hi I have a bit of a problem. Is there any way i can write some text to a middle of a text file. For

Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a var

Need help with some php code :)
Hey! I'm quite new to this whole thing, so please don't fire me with shait on this one =D

I'm

PHP error (line 38) my website
Hello everyone, I'm new on this
and I got a web site thats got a error not showing the photos on<

Loosing changed contents when used FM REUSE_ALV_GRID_DISPLAY
Hi,

I have used FM REUSE_ALV_GRID_DISPLAY in my program as below.

CALL FUNCT

remove innitial

and

tags
i am using tiny_mce as a text editor for my CMS.
buy now the problem is it add <p>

Strange HTML Tag?
I recently noticed some odd HTML appear in some of the websites I host. Not all of them are run on a

Asset Transfer from One plant to another within same company code
Hi,

Please advise how to transfer one asset from one plant to another plant within same c

Create comparison matrix?
I want to create a comparison script for forum software and was wondering is there any tutorial or b

List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab

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