note 37799 added to function.htmlentities

From: Date: Thu, 27 Nov 2003 17:01:42 +0000
Subject: note 37799 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-61035@lists.php.net to get a copy of this message
If you are looking for a htmlentities inverse : <? $table = array_flip(get_html_translation_table(HTML_ENTITIES)); $plaintext = strtr($html, $table); ?> Here is a full example to extract plaintext from a SIMPLE html page (not table, etc...) <? $file_content = file_get_contents($htmlfile); $file_content = strip_tags($file_content, '<br>'); $file_content = preg_replace('/<br( )?(\/)?>/i', "\n", $file_content); $file_content = wordwrap($file_content); $table = array_flip(get_html_translation_table(HTML_ENTITIES)); $file_content = strtr($file_content, $table); ?> ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37799 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37799&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37799&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61035) next »