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, Quote Link to comment 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. Quote Link to comment 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>" Quote Link to comment 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. Quote Link to comment 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] 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.