Matching a XML/HTML tag


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function get_tag( $tag, $xml ) {
  2. $tag = preg_quote($tag);
  3. preg_match_all('{<'.$tag.'[^>]*>(.*?)</'.$tag.'>.'}',
  4. $xml,
  5. $matches,
  6. PREG_PATTERN_ORDER);
  7.  
  8. return $matches[1];
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.