$link = http://site.com/view/page.php?id=50&reviews=show
How can we add &extra=video after id=50?
idis always numeric.- url can have many other variables after
?id=50 &extra=videoshould be added before the first&and after the50(value ofid)
It will be used this way:
echo '<a href="' . $link . '">Get video</a>';
Thanks.
Is ID always the first post parameter? If so, then you could jsut do some sort of string manipulation. Use
strpos($link, "&")to find out the position where you want to insert. Then do a fewsubstr()based on that position and then append them all together. Its kind of hacky I know, but it will definitely work.See this link for some of the string manipulation functions that I mentioned above: https://www.php.net/strings