如何在php中删除URL参数字符串的一部分

Why does this not remove the example/ :

$url = "http://webserver/exmaple/subdomaine/";
$domaine="example"
$domaine= $domaine."/";
echo str_replace($domaine,"",$url);

Is there a better way to do so ?

Thanks!

$domaine = "example"; // Missing semicolon ...

Check spelling:

exmaple !== example

exmaple would be a tree that was a maple in the past but is now another type of tree such as an oak or yew.

did a mistake here

$domaine="example"

replace it by

$domaine="example";