Thread: php question?
View Single Post
(#2 (permalink))
Old
dhvrm is Offline
Private
Points: 199, Level: 2 Points: 199, Level: 2 Points: 199, Level: 2
Activity: 0% Activity: 0% Activity: 0%
dhvrm is an unknown quantity at this point
 
 
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Dec 2007
December 25th, 2007

You can use a regular expression and preg_match.

$haystack = "<html>WORDS</html>";
$pattern = "/(<.*>)(.*)(</.*>)/";
$return = preg_match($pattern, $haystack);

$return will be a four-cell array. $return[0] contains all of $haystack. $return[1] contains <html>, $return[2] contains WORDS. $return[3] contains </html>.

http://us.php.net/manual/en/function.preg-match.php