note 91675 modified in function.htmlspecialchars by danbrown

From: Date: Mon, 22 Jun 2009 17:24:21 +0000
Subject: note 91675 modified in function.htmlspecialchars by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157244@lists.php.net to get a copy of this message
<?php /** * A recursive version of htmlspecialchars() for arrays and strings. * */ function htmlspecialchars_deep($mixed, $quote_style = ENT_QUOTES, $charset = 'UTF-8') { if (is_array($mixed)) { foreach($mixed as $key => $value) { $mixed[$key] = htmlspecialchars_deep($value, $quote_style, $charset); } } elseif (is_string($mixed)) { $mixed = htmlspecialchars(htmlspecialchars_decode($mixed, $quote_style), $quote_style, $charset); } return $mixed; } ?> --was-- <?php /** * A recursive version of htmlspecialchars() for arrays and strings. * */ function htmlspecialchars_deep($mixed, $quote_style = ENT_QUOTES, $charset = 'UTF-8') { if (is_array($mixed)) { foreach($mixed as $key => $value) { $mixed[$key] = htmlspecialchars_deep($value, $quote_style, $charset); } } elseif (is_string($mixed)) { $mixed = htmlspecialchars(htmlspecialchars_decode($mixed, $quote_style), $quote_style, $charset); } return $mixed; } http://php.net/manual/en/function.htmlspecialchars.php

« previous php.notes (#157244) next »