kaneos Posted October 23, 2011 Share Posted October 23, 2011 I have a string $str that contains a web page information. it has multiple title tags [title][/title] within it. How do I get the contents within all these title tags thanks Quote Link to comment https://forums.phpfreaks.com/topic/249665-getting-string-between-two-tags/ Share on other sites More sharing options...
WebStyles Posted October 24, 2011 Share Posted October 24, 2011 Try something like this: preg_match_all('/\<title\>(.*?)\<\/code\>/is', $str, $matches); echo '<pre>'; print_r($matches); echo '</pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/249665-getting-string-between-two-tags/#findComment-1281731 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.