note 40051 added to function.htmlspecialchars
| From: | DaveDuchene at rn2 dot php dot net | Date: | Thu, 19 Feb 2004 22:58:02 +0000 |
| Subject: | note 40051 added to function.htmlspecialchars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65430@lists.php.net to get a copy of this message | ||
Here is a handy function that will escape the contents of a variable, recursing into arrays.
<?php
function escaporize($thing) {
if (is_array($thing)) {
$escaped = array();
foreach ($thing as $key => $value) {
$escaped[$key] = escaporize($value);
}
return $escaped;
}
// else
return htmlspecialchars($thing);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.htmlspecialchars.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40051
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40051&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40051&report=yes
Search -- http://master.php.net/manage/user-notes.php