note 17336 added to function.htmlspecialchars
| From: | the_php_guy at e-clecticity dot net | Date: | Wed, 05 Dec 2001 04:08:48 +0000 |
| Subject: | note 17336 added to function.htmlspecialchars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21621@lists.php.net to get a copy of this message | ||
This function is great for displaying code. Let's say you
have a PHP file named example.php and you want to display
the code on a web page. Here's all you do:
<pre>
<?php
$code = file("example.php");
while ($nextline = each($code))
echo htmlspecialchars($nextline["value"]);
?>
</pre>
Since the file's opening script tag gets converted to
<?php, the entire file will be displayed rather than interpreted.
--
http://www.php.net/manual/en/function.htmlspecialchars.php
http://master.php.net/manage/user-notes.php?action=edit+17336
http://master.php.net/manage/user-notes.php?action=delete+17336
http://master.php.net/manage/user-notes.php?action=reject+17336