Guest User

Untitled

a guest
Jan 15th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.30 KB | None | 0 0
  1. //check that the string starts with a digit, and contains only alphanumeric characters.
  2. $pattern = '/^[0-9][0-9A-Za-z]*/';
  3. $str1 = '5fun4all';
  4. $str2 = 'fun4all5';
  5. if (preg_match($pattern, $subject)) {
  6.     //more about preg_functions coming up
  7. }
  8.  
  9. //The pattern matches '5fun4all' but not 'fun4all5'
Add Comment
Please, Sign In to add comment