Reputation: 3560
I need to sub-string the value within some special character using PHP. I am showing the original string below.
"name=G%20+%20l&cid=20"
In the above string I need the value within name=
to next &
.
Upvotes: 0
Views: 69
Reputation: 2588
Try this:
$string = "name=G%20+%20l&cid=20";
$explode_string = explode("&", $string);
$explode_string2 = explode("name=", $explode_string[0]);
echo array_pop($explode_string2);
Output will be like:
G%20+%20l
Upvotes: 1