function isAllowedMethod($url) { $allowedPrefixes = array('http://', 'ftp://', 'https://', 'ftps://'); foreach ($allowedPrefixes as $prefix) { if (substr($url, 0, strlen($prefix)) === $prefix) { return true; } } return false; }