I need to run a check on multiple variables, some of which will be urls and others will only contain no more than 5 or 6 characters, none of which will ever be "http".
Which of the two methods below gives the best performance in terms of speed and processor load.
$str = 'http://somereallylongwebaddress.com';
if (substr( $str, 0, 4 ) === "http") {
// true
}
if (strlen( $str >= 7 )) {
// true
}
EDIT For anybody else that is interested I found this great page which runs live comparisons of various different functions. It doesn't address my particular one but very informative all the same.