user3350731
user3350731

Reputation: 972

How to remove a part of a URL argument string in php

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!

Upvotes: 0

Views: 55

Answers (3)

nanobash
nanobash

Reputation: 5500

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

Upvotes: 1

Ferrakkem Bhuiyan
Ferrakkem Bhuiyan

Reputation: 2783

did a mistake here

$domaine="example"

replace it by

$domaine="example";

Upvotes: 0

AbraCadaver
AbraCadaver

Reputation: 78994

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.

Upvotes: 0

Related Questions