Get Text Between Tags

Description: Gets the text between any pair of tags, matching or not.

<?PHP
 
$str = "
Line 1: This is a string
Line 2: <pre>This is something within a pre-formatted section
spanning 2+ lines.
The end.

Should not be included.
Line 3: End of test string.”;

PREG_MATCH(“|

(.+)

|si”, $str, $m);
ECHO NL2BR($m[1]);

?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.