fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. function isMail($value)
  6. {
  7.  
  8. $re = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i';
  9.  
  10. if (!preg_match($re, $value))
  11. {
  12. return false;
  13. }
  14.  
  15. return true;
  16. }
  17.  
  18. print_r(date("H:s"));
  19. print_r("\n");
  20. print_r(isMail("123") ? "true" : "false");
  21. print_r("\n");
  22. print_r(isMail("hoge@test.com") ? "true" : "false");
  23. print_r("\n");
  24. print_r(isMail("aaaaa123..@test.com") ? "true" : "false");
  25. print_r("\n");
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
03:46
false
true
true