0

I have a string with a URL

$string = "http://www.yahoo.com/foo.php?bar=201";

all i want is the query string without everything else.

obviously cant user query_string, help appreciated.

1
  • Your syntax, sense makes none. Commented Aug 25, 2012 at 6:39

1 Answer 1

5
$parts = parse_url($string);
echo $parts['query'];

http://php.net/manual/en/function.parse-url.php

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.