Check whether url contains http:// or https://

Check whether url contains http:// or https://
if your string is a URL you can use parse_url(), which will return the URL components in an associative array
$strUrl       = $websiteLink;
$arrParsedUrl = parse_url($strUrl);
p($arrParsedUrl);
if (!empty($arrParsedUrl[‘scheme’]))
{
// Contains http:// schema
if ($arrParsedUrl[‘scheme’] === “http”){
}
// Contains https:// schema
else if ($arrParsedUrl[‘scheme’] === “https”){
}
}
// Don’t contains http:// or https://
else{
}