AndyPSV Posted March 22, 2011 Share Posted March 22, 2011 Hello, I've got link, e.g.: module1/blabala/?&loc=United-States?q=12345&dasasdas=321321 I want to only extract the phrase where: if(strpos($_GET[0].$_GET[1].$_GET[2].$_GET[3].$_GET[4].$_GET[5],'?q=') !== false) { ... here I want to get only value: 12345 How to get it? -- 2. how to remove string: ?q=NUMBER (e.g. ?q=12345) through preg_match()? Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted March 22, 2011 Share Posted March 22, 2011 it's easier to use parse_url Quote Link to comment Share on other sites More sharing options...
AndyPSV Posted March 22, 2011 Author Share Posted March 22, 2011 preg_match('/(?<=[&?]q=)[^&]+/',$uri,$uri_); var_dump($uri_); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.