Hello everyone! First of all thanks to all who helped in the past on my c++ problems, but now I need help with some php. I'm trying to search the beginning of a string for the http:// string but am having trouble with it. I can find the string inside the string but can't find it at the beginning of the string. In my attached code I wrapped a strpos() function inside of a substr() function and am trying to search the start of the string and stop the search after the http:// characters. I've tried changing the number of characters from 0 to 1 and 7 to 6 because strings start at 0 I suppose? Also, what about using JavaScript to check instead? although I'd rather use php. Any help would be greatly appreciated. Thank you!
$start = 0;
$end = 6;
$string = "http://";
if (substr(strpos($url, '$string'), '$start', '$end') === false ) {
die("Link must begin with http://");
}