PHP if / if else statement not working as expected (Probably Simple) -
ok, trying if / else if statement doesn't act expect. trying check url address enters things. way have done crap not @ programming.
all if parts work except bit if (strpos($urlcheck, "http://") == false)
it supposed check if url has http:// in it. whether or doesn't still acts same way.
i tried forcing http:// url stripping of http:// or https://.
when echo variable ($urlcheck) , shows url http://.....so why doesn't code work? thanks
$url = htmlspecialchars($_post["url"]); $urlremovesarray = array('https//:', 'http//:'); $urlhttp = str_replace($urlremovesarray, "", $url); $urlcheck = "http://" . $urlhttp; $urlsearchcheck2 = 'property-profile/'; $urlsearchcheckdomain = "domain"; if (strpos($url, $urlsearchcheck2) !== false) { echo "test 1"; } else if (strpos($urlcheck, "http://") == false) { echo "test 2"; echo $urlcheck; } else if (strpos($urlcheck, $urlsearchcheckdomain) == false) { echo "test 3"; } else if (strpos($urlcheck, $urlsearchcheckdomain) == true) { continue1(); }
update: still no solutions why doesn't work? have copy , pasted code page , still doesn't work.
use same !== false
statement:
$urlcheck = 'http://www.google.com'; if (strpos($urlcheck, "http://") !== false) { echo "test 2"; echo $urlcheck; }
Comments
Post a Comment