Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getTextBetweenTags($string, $tagname,$i)
- {
- //echo $string.' - '.$tagname.'<br>';
- $matches = array();
- $pattern = "/<$tagname>(.*?)<\/$tagname>/";
- preg_match($pattern, $string, $matches);
- //print_r($matches);
- return $matches;
- }
- $html = '<html>
- <body>
- <para>1</para>
- <para>2</para>
- </body>
- </html>';
- $content = getTextBetweenTags( $html,'para', 1);
- foreach( $content as $item )
- {
- echo $item.'<br>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement