Advertisement
Geicy

Untitled

Jul 9th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.21 KB | None | 0 0
  1. <?php
  2.  
  3. $string = "09/07/2021";
  4. $padrao = "/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/";
  5.  
  6. if(preg_match($padrao, $string)):
  7.     echo "Válido";
  8.     echo "<hr>";
  9.     echo $string;
  10. else:
  11.     echo "Inválido";
  12.     echo "<hr>";
  13. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement