I have this little snippet here, and it returns false
even if it satisfies the if
statement.
$urls = $_POST['links'];
trim($urls);
$urls = explode("\r\n",$urls);
foreach($urls as $url){
trim($url);
if(strpos($url,'http://') === false)
$url = 'http://'.$url;
$parse = parse_url($url, PHP_URL_HOST);
if(($parse != 'site.com') || ($parse != 'www.site.com')) //problem here
echo 'false:'.$parse.'<br>';
else
echo 'true:'.$parse;
}
The input is from a textarea:
http://site.com
site.com
http://www.site.com
www.site.com
Output:
true:site.com
true:site.com
false:www.site.com
false:www.site.com
What do you think is the problem?