greenba Posted September 20, 2006 Share Posted September 20, 2006 Hi,I have the following string:"<div class="style1">Company</div>"How can I get just the "Company"?Any ideas?regards, Link to comment https://forums.phpfreaks.com/topic/21338-read-between-the-selected-tag/ Share on other sites More sharing options...
Tandem Posted September 20, 2006 Share Posted September 20, 2006 strip_tags() will remove any html tags from a string if thats what you need. Link to comment https://forums.phpfreaks.com/topic/21338-read-between-the-selected-tag/#findComment-94989 Share on other sites More sharing options...
greenba Posted September 20, 2006 Author Share Posted September 20, 2006 That is OK, but I have many different tabs so i cannot just strip tags.this is what I have:"<div class="style1">Company</div><div class="style1">name</div><div class="style1">age</div>" Link to comment https://forums.phpfreaks.com/topic/21338-read-between-the-selected-tag/#findComment-94991 Share on other sites More sharing options...
Tandem Posted September 20, 2006 Share Posted September 20, 2006 Sorry i'm not sure about that, however i would quite like to know how too, so i would also appreciate it if anybody could explain. Link to comment https://forums.phpfreaks.com/topic/21338-read-between-the-selected-tag/#findComment-95026 Share on other sites More sharing options...
effigy Posted September 20, 2006 Share Posted September 20, 2006 [code]<pre><?php $data = <<<DATA <div class="style1">Company</div> <div class="style1">name</div> <div class="style1">age</div>DATA; preg_match('%^\s+<div.*?>(.+?)</div>%', $data, $matches); echo $matches[1];?>[/code] Link to comment https://forums.phpfreaks.com/topic/21338-read-between-the-selected-tag/#findComment-95032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.