Reputation: 81
The below code deletes to the left and not to the right.
Actual code:
$citygen=substr($citygen,strrpos($citygen,'&fbclid='));
Example:
?geo&moyobamba&fbclid=fdfdsfddsfds4324
I need to delete to the right from &fbclick=
(since sometimes these numbers change)
Upvotes: 1
Views: 61
Reputation: 147206
You're missing the $start
parameter to substr
, so it is fetching characters from the location of &fblcid
onwards. Try this instead:
$citygen = '?geo&moyobamba&fbclid=fdfdsfddsfds4324';
$citygen = substr($citygen,0,strrpos($citygen,'&fbclid='));
echo $citygen;
Output:
?geo&moyobamba
Upvotes: 3