19
validatewebsite
validate_website
SYNOPSIS
validate_website($url)
DESCRIPTION
CODE
- function validate_website($url) {
- return preg_match('#^(http(s)?://)?(www\.)?(([^\.]+)\.)+[a-z]{2,}$#', $url);
- }
normalize_website
SYNOPSIS
normalize_website($url)
DESCRIPTION
CODE
- function normalize_website($url) {
- return preg_replace('#^(http(s)?://)?((www\.)?([^\.]+)\.[a-z]{2,})$#', '\3', $url);
- }
Commentaires