Posted By

khaled on 10/06/10


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

pytheas
bobbym245
abdulaziz
guziec
cjmling


Valid Username


 / Published in: PHP
 

  1. function valid_username($username)
  2. {
  3. return ! preg_match('/[^a-z0-9_-]/i', $username);
  4. }
  5.  
  6. if( valid_username('khal3d') ) {
  7. echo 'Ok';
  8. }else{
  9. echo 'Wrong!';
  10. }

Report this snippet  

You need to login to post a comment.