Jump to content

Archived

This topic is now archived and is closed to further replies.

greenba

read between the selected tag

Recommended Posts

Hi,

I have the following string:
"
<div class="style1">Company</div>
"
How can I get just the "Company"?

Any ideas?

regards,

Share this post


Link to post
Share on other sites
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>
"

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.