Friday, 13 September 2013

Check if string starts with http or www or /

Check if string starts with http or www or /

This works:
if (strpos($page, 'http') == 0) {
$link = 'Test';
}
But this doesn't:
if (strpos($page, 'http' || 'www' || '/') == 0) {
$link = 'Test';
}
I need to return something if $page does not begin with any of those
three: http, www, or /.

No comments:

Post a Comment