Posted By

on 12/25/08


Tagged

get php tags text between


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

lostofctrl
jeremyhcobb
guillermoj88gmailcom


php - get text between tags


 / Published in: PHP
 

URL: http://www.phpro.org/examples/Get-Text-Between-Tags.html

pretty usefull

  1. function getTextBetweenTags($string, $tagname)
  2. {
  3. $pattern = "/<$tagname>(.*?)<\/$tagname>/";
  4. preg_match($pattern, $string, $matches);
  5. return $matches[1];
  6. }

Report this snippet   <

You need to login to post a comment.