Quick Search:
 
 PHP Code: Get text between tags Jump to:  
Category: >> PHP Code >> Get text between tags  

<< lastnext >>

Snippet Name: Get text between tags

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

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: February 27th, 2009

<?PHP
 
$str = " 
Line 1: This is a string 
Line 2: <pre>This is something within a pre-formatted section 
spanning 2+ lines. 
The end.</pre> Should not be included. 
Line 3: End of test string."; 
 
PREG_MATCH("|<pre>(.+)</pre>|si", $str, $m); 
ECHO NL2BR($m[1]); 
 
?> 
 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org