Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function verifierLogin($login)
- {
- if (strlen($login) < 4) {
- throw new InvalidArgumentException("Votre login doit contenir au moins 4 caractères");
- }
- if (strlen($login) > 10) {
- throw new InvalidArgumentException("Votre login ne doit pas dépasser les 10 caractères");
- }
- }
- function verifierFormulaire(array $form)
- {
- try {
- verifierLogin($form);
- } catch (InvalidArgumentException $exception) {
- echo "<span class='error'>" . $exception->getMessage() . "</span>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement