Skip to content

Instantly share code, notes, and snippets.

@biswajitpaul01
Created August 31, 2019 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biswajitpaul01/f83e0128b55be189615566e0022ec51d to your computer and use it in GitHub Desktop.
Save biswajitpaul01/f83e0128b55be189615566e0022ec51d to your computer and use it in GitHub Desktop.
Extract query parameters from url
<?php
$href = 'https://in.pinterest.com/bhagyashrijadhav51/happy/?utm_campaign=rdboards&e_t=5c7cb45aadb34115ba86ab4531b61a23&utm_content=733664664235398280&utm_source=31&utm_term=3&utm_medium=2004';
$query_str = parse_url($href, PHP_URL_QUERY);
parse_str($query_str, $query_params);
echo $query_params['utm_campaign'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment