note 33480 modified in function.str-replace by aidan
| From: | aidan@php.net | Date: | Mon, 28 Jun 2004 10:01:18 +0000 |
| Subject: | note 33480 modified in function.str-replace by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71987@lists.php.net to get a copy of this message | ||
An excellent way of making sure your pages don't contain "invalid entities", IE.
Valid HTML is using the following function.
Most forum packages / extensions provide output containing the symbol &, we don't want
this!
<?php
function include_safe ($file)
{
$array = file($file);
foreach ($array as $line) {
print str_replace("&", "&", $line);
}
}
?>
The same technique could also be used in conjuntion with htmlmspecialchars or htmlentities.
--was--
An excellent way of making sure your pages don't contain "invalid entities", IE.
Valid HTML is using the following function.
Most forum packages / extensions provide output containing the symbol &, we don't want
this!
<?php
function include_safe ($file)
{
$array = file($file);
foreach ($array as $line) {
print str_replace("&", "&", $line);
}
}
?>
The same technique could also be used in conjuntion with htmlmspecialchars or htmlentities.
http://php.net/manual/en/function.str-replace.php