PHP: Native e-mail and URL validation
A clean and easy way to validate an e-mail address or URL in PHP:
More information on this can be found on:
https://www.php.net/manual/en/function.filter-var.php
https://www.php.net/manual/en/filter.filters.flags.php
$validEmail = (bool) filter_var($email, FILTER_VALIDATE_EMAIL); $validUrl = (bool) filter_var('http://example.com', FILTER_VALIDATE_URL);
More information on this can be found on:
https://www.php.net/manual/en/function.filter-var.php
https://www.php.net/manual/en/filter.filters.flags.php
Add new comment