The following is a test snippet piece of code from a script. This snippet is supposed to split a list of urls from the urls' description and remove the urls scheme (http, https) if present. Here is the code:
Code:
<?php
///test urls NOTE "|" separates url form the urls description
$inputuri = <<<URLS
http://testa.com|description1
http://testa.com|description1
http://testb.com|description2
testc.com|description3
URLS;

echo "<pre>".$inputuri ."</pre><br />";

$inputuri_exp = explode("\r", $inputuri);//explodes inputuri for multipe urls


foreach($inputuri_exp as $value)
	{
		$value_exp = explode("|", $value);//explodes value to get url and description

		$url = strtolower($value_exp[0]);//url value

		$descr = $value_exp[1];//url description

		$url_parsed = parse_url($url);//url parsed to get scheme

		$scheme = $url_parsed['scheme'];//set scheme to variable
		

		//removes url scheme from $urls variable if present
		if(stripos($url, $scheme) === FALSE)
			{
				$url = $url;//does not contain a scheme like http or https

			}else
			{
				$url = substr($url, strlen($scheme) + 3);//contains a scheme adds 3 characters for ://
			
			}
		echo $url. "::". $descr. "<br />";
		
	}

?>
I expect the output to be:
Code:
http://testa.com|description1
http://testa.com|description1
http://testb.com|description2
testc.com|description3


testa.com::description1
testa.com::description1
testb.com::description2
testc.com::description3
But instead it is what is below. Notice how the second "testa.com" and "testb.com" still have their schemes' (http://)? It seems after going through the foreach loop once the scheme is not found in the url even if present. I have been racking my brain for hours. What have I done wrong?

Code:
http://testa.com|description1
http://testa.com|description1
http://testb.com|description2
testc.com|description3


testa.com::description1
http://testa.com::description1
http://testb.com::description2
testc.com::description3