Hi

I have the following array:

$links = array("Home", "About us", "Our Services");


foreach($links as &$link ){
	
$space =	implode(" ", $links);
	
	echo $space ;
	break;
	
	
	
}

the above code displays Home About us Our Services, but now I want to use the same array for links so each one of the sections needs to be linked, how can I remove the white spaces so "

About us

" becomes "

aboutus

".

Thanls

$myurl="About us";
$mynewurl=strtolower(str_replace(" ","",$myurl));
Member Avatar for diafol

Pretty much as urtrivedi says.

$links = array("Home", "About us", "Our Services");
foreach($links as &$link ){
	$link = strtolower(str_replace(" ","",$link));
}

Although you've now changed the original array.

$links = array("Home", "About us", "Our Services");
foreach($links as $link ){
	$urls[] = strtolower(str_replace(" ","",$link));
}

will place new array as $urls

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.