foolfell
foolfell

Reputation: 1

How can I refine PHP sub-string and chop functions

I have the PHP code below, so my question is how can I refine it?

$slug                   = $_SERVER['REQUEST_URI'];
$myslug                 = substr($slug, 4);
$new_slug               = chop($myslug,"?lang=fr");

Upvotes: -1

Views: 76

Answers (1)

Mihai Aurelian
Mihai Aurelian

Reputation: 224

You could eliminate all those variables.

$slug = chop(substr($_SERVER['REQUEST_URI'], 4),"?lang=fr");

Upvotes: 0

Related Questions