Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF statement help

Status
Not open for further replies.

mufka

ISP
Dec 18, 2000
587
US
I need to create an if statement that checks to see if a variable is a letter from a-z. If the variable is a-z it exits. If the variable is anything else it will do something else. I can't seem to find the correct comparison operator.

Thanks
 
Something like this should work:

Code:
$haystack="abcdefghijklmnopqrstuvwxyz";
if(strpos($haystack,$myvar)){
[green]//do something[/green]
}

It checks wether the contents of $myvar exists in the given string.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top