Grab values from PHP string


Grab values from PHP string
I have a variable in my PHP script called $url
$url
Here's an example of how I use it:
<?php
$url = '/test/?utm_source=test&utm_campaign=test2&utm_medium=test3";
I'd like to have a PHP snippet that grabs the valus of utm_source
, utm_campaign
& utm_medium
. How do I achieve this?
utm_source
utm_campaign
utm_medium
1 Answer
1
I have a feeling that the function parse_str()
is exactly what you are looking for. See https://secure.php.net/manual/en/function.parse-str.php
parse_str()
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments
Post a Comment