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()? Link to comment https://forums.phpfreaks.com/topic/231391-how-to-show-only-q12345/ Share on other sites More sharing options...
JAY6390 Posted March 22, 2011 Share Posted March 22, 2011 it's easier to use parse_url Link to comment https://forums.phpfreaks.com/topic/231391-how-to-show-only-q12345/#findComment-1190821 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_); Link to comment https://forums.phpfreaks.com/topic/231391-how-to-show-only-q12345/#findComment-1190829 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.