Get parameter from an URI string in PHP


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Will echo "value1"
  2. parse_str(parse_url('www.test.com/test.php?param1=value1&param2=value2', PHP_URL_QUERY), $query_data);
  3. echo $query_data['param1'];

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.