been on this for 2 hours now …
$string = "https://www.example.com/?id=fsdf29512590125Agajgenaemganheji";
$end = strrchr($string, 'id='); // should return "fsdf29512590125Agajgenaemganheji"
echo $end;
only returns "i"
these work but not in larger url
$s = "https://www.example.com/?id=fsdf29512590125Agajgenaemganheji";
$firstPart = strtok( $s, 'id=' );
echo $firstpart;
tried also 'id='
How to get everything after a certain character?
return id=
value without id=
thank you
2
Answers
If you don’t mind using explode, you can try this
You are trying to get the value of a parameter from a URL query string here, so you might as well use the functions that PHP explicitly provides for such purposes.