Use preg_match().
if (!preg_match('/[^A-Za-z0-9]/', $string)) // '/[^a-z\d]/i' should also work.
{
// string contains only english letters & digits
}
More Related Contents:
- Turn Plain Text URLs into Active Links using PHP [closed]
- How to find value between commas
- How to validate an email address in PHP
- How to validate an Email in PHP?
- deny direct access to a folder and file by htaccess
- parse youtube video id using preg_match [duplicate]
- PHP: Regex to ignore escaped quotes within quotes
- Convert plain text URLs into HTML hyperlinks in PHP
- Remove style attribute from HTML tags
- “vertical” regex matching in an ASCII “image”
- Regular expression pattern to match URL with or without http://www
- Match a^n b^n c^n (e.g. “aaabbbccc”) using regular expressions (PCRE)
- What Delimiter to use for preg_replace in PHP (replace working outside of PHP but not inside)
- Parsing CSS by regex
- Remove repeating character
- Codeigniter Routes regex – using dashes in controller/method names
- Replace only first match using preg_replace [duplicate]
- php regex to get string inside href tag
- Tilde operator in Regular expressions
- Explode string by one or more spaces or tabs
- How to prefix a positive number with plus sign in PHP
- Regex / DOMDocument – match and replace text not in a link
- Converting Javascript Regex to PHP
- Extract floating point numbers from a delimited string in PHP
- Parse math operations with PHP
- How to validate phone number using PHP? [duplicate]
- What does [\S\s]* mean in regex in PHP?
- UTF-8 in PHP regular expressions [duplicate]
- Get non-numeric characters then number on each line of a block of texf
- Validate date format in php