How to remove part of a string start from specific character in PHP

1 Answer

0 votes
$url = "collectivesolver.com/35131/how-to-check-if-%24_get-is-empty-in-php";

$pos = strpos($url, ".");
if ($pos) {
	$url = substr($url, 0, $pos);
}

echo $url;



/*
run:

collectivesolver

*/

 



answered Oct 11, 2020 by avibootz
...