note 74347 added to function.ereg-replace
| From: | bmcswee at gmail dot com dot invalid | Date: | Fri, 06 Apr 2007 16:33:17 +0000 |
| Subject: | note 74347 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125151@lists.php.net to get a copy of this message | ||
Function to strip an HTML tag out of a string. I use this in part for parsing XML documents.
<?php
function stripTags($tag, $string) {
// Regular expressions only work with strings if the regexp has been pre-concocted
$regExp = "<" . "$tag" . "[^>]*>";
$string = str_replace("</$tag>", "", $string);
$string = ereg_replace($regExp, "", $string);
return $string;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 76.167.20.83
----
Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php
Edit -- https://master.php.net/note/edit/74347
Del: integrated -- https://master.php.net/note/delete/74347/integrated
Del: useless -- https://master.php.net/note/delete/74347/useless
Del: bad code -- https://master.php.net/note/delete/74347/bad+code
Del: spam -- https://master.php.net/note/delete/74347/spam
Del: non-english -- https://master.php.net/note/delete/74347/non-english
Del: in docs -- https://master.php.net/note/delete/74347/in+docs
Del: other reasons-- https://master.php.net/note/delete/74347
Reject -- https://master.php.net/note/reject/74347
Search -- https://master.php.net/manage/user-notes.php