note 33480 deleted from function.str-replace by philip

From: Date: Wed, 07 Oct 2009 08:05:44 +0000
Subject: note 33480 deleted from function.str-replace by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161464@lists.php.net to get a copy of this message
Note Submitter: imho at auspantheon dot com ---- 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('&', '&amp;', $line); } } ?> The same technique could also be used in conjuntion with htmlmspecialchars or htmlentities.

« previous php.notes (#161464) next »