note 120941 added to function.strip-tags
| From: | Anonymous | Date: | Wed, 05 Apr 2017 12:05:59 +0000 |
| Subject: | note 120941 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-208980@lists.php.net to get a copy of this message | ||
Just bzplan's function with the option to choose what tags are replaced for
function rip_tags($string, $rep = ' ') {
// ----- remove HTML TAGs -----
$string = preg_replace ('/<[^>]*>/', $rep, $string);
// ----- remove control characters -----
$string = str_replace("\r", '', $string); // --- replace with empty space
$string = str_replace("\n", $rep, $string); // --- replace with space
$string = str_replace("\t", $rep, $string); // --- replace with space
// ----- remove multiple spaces -----
$string = trim(preg_replace('/ {2,}/', $rep, $string));
return $string;
}
----
Server IP: 72.52.91.14
Probable Submitter: 200.42.230.34
----
Manual Page -- http://php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/120941
Del: integrated -- https://master.php.net/note/delete/120941/integrated
Del: useless -- https://master.php.net/note/delete/120941/useless
Del: bad code -- https://master.php.net/note/delete/120941/bad+code
Del: spam -- https://master.php.net/note/delete/120941/spam
Del: non-english -- https://master.php.net/note/delete/120941/non-english
Del: in docs -- https://master.php.net/note/delete/120941/in+docs
Del: other reasons-- https://master.php.net/note/delete/120941
Reject -- https://master.php.net/note/reject/120941
Search -- https://master.php.net/manage/user-notes.php