Whats the easiest way to use htmlentities to a complete array not knowing the elements of the array?
I am thinking foreach but it escapes me how to change the array value within the foreach.
htmlentities on an array
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: htmlentities on an array
AGISB wrote:Whats the easiest way to use htmlentities to a complete array not knowing the elements of the array?
I am thinking foreach but it escapes me how to change the array value within the foreach.
Code: Select all
foreach ($array as $key => $value)
{
$array[$key] = htmlentities($value);
}
print_r($array);http://us3.php.net/manual/en/function.array-map.php
Code: Select all
$array = array_map("htmlentities", $array);- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia