1//php check if first four characters of a string = http
2substr( $http, 0, 4 ) === "http";
3//php check if first five characters of a string = https
4substr( $https, 0, 5 ) === "https";
5
1function startsWith($haystack, $needle)
2{
3 $length = strlen($needle);
4 return (substr($haystack, 0, $length) === $needle);
5}
6
7function endsWith($haystack, $needle)
8{
9 $length = strlen($needle);
10 if ($length == 0) {
11 return true;
12 }
13
14 return (substr($haystack, -$length) === $needle);
15}