note 80429 added to function.strip-tags
| From: | bstrick at gmail dot com | Date: | Tue, 15 Jan 2008 17:52:35 +0000 |
| Subject: | note 80429 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135121@lists.php.net to get a copy of this message | ||
This will strip all PHP and HTML out of a file. Leaves only plain txt.
// Open the search file
$file = fopen($filename, 'r');
// Get rid of all PHP code.
$search = array('/<\?((?!\?>).)*\?>/s');
$text = fread($file, filesize($filename));
$new = strip_tags(preg_replace($search, '', $text));
echo $new;
fclose($file);
- Strick
----
Server IP: 209.41.74.194
Probable Submitter: 132.170.244.117
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/80429
Del: integrated -- https://master.php.net/note/delete/80429/integrated
Del: useless -- https://master.php.net/note/delete/80429/useless
Del: bad code -- https://master.php.net/note/delete/80429/bad+code
Del: spam -- https://master.php.net/note/delete/80429/spam
Del: non-english -- https://master.php.net/note/delete/80429/non-english
Del: in docs -- https://master.php.net/note/delete/80429/in+docs
Del: other reasons-- https://master.php.net/note/delete/80429
Reject -- https://master.php.net/note/reject/80429
Search -- https://master.php.net/manage/user-notes.php