How to take the parameter of a url that is inside a variable of type string
The purpose is to extrapolate the value of a parameter that makes up a url saved in a string type variable. So let’s imagine we have such a valued variable
$string = 'https://domain.ext/test/page?attribute=qwerty123&option=2';
If we wanted to extract the attribute parameter value from this url we should use the following code
$attr = parse_url($string);
parse_str($attr['query'], $query);
echo $query['attribute'];
which will print on the screen the value of the attribute parameter, that is querty123. This also applies to the option parameter.
Pay attention that these are not the POST and GET methods, this procedure is used to extrapolate the parameter from a link already valued in your code, and which does not necessarily come from the page request.