note 89371 modified in function.html-entity-decode by danbrown
| From: | danbrown@php.net | Date: | Wed, 04 Mar 2009 23:37:24 +0000 |
| Subject: | note 89371 modified in function.html-entity-decode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151492@lists.php.net to get a copy of this message | ||
I created this function to filter all the text that goes in or comes out of the database.
<?php
function filter_string($string, $nohtml='', $save='') {
if(!empty($nohtml)) {
$string = trim($string);
if(!empty($save)) $string = htmlentities(trim($string), ENT_QUOTES, 'ISO-8859-15');
else $string = html_entity_decode($string, ENT_QUOTES, 'ISO-8859-15');
}
if(!empty($save)) $string = mysql_real_escape_string($string);
else $string = stripslashes($string);
return($string);
}
?>
--was--
I created this function to filter all the text that goes in or comes out of the database.
function filter_string($string, $nohtml='', $save='') {
if(!empty($nohtml)) {
$string = trim($string);
if(!empty($save)) $string = htmlentities(trim($string), ENT_QUOTES, 'ISO-8859-15');
else $string = html_entity_decode($string, ENT_QUOTES, 'ISO-8859-15');
}
if(!empty($save)) $string = mysql_real_escape_string($string);
else $string = stripslashes($string);
return($string);
}
http://php.net/manual/en/function.html-entity-decode.php