Re: array walk?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Take a look at array_walk()
http://be2.php.net/manual/en/function.array-map.php

It might be better for what you're doing.

Juan Ignacio Borda wrote:
this code doesn't work on my PHP Version 5.2.1 (i'm trying to protect a stie from XSS)

<?php
$a=Array();
$a[]='<i>como</i>';
$a[]=Array('<b>hola</b>','hello');
array_walk_recursive($a,'strip_tags');
echo "<pre>";
var_dump($a);
echo "</pre>";
?>
it outputs:

<pre>array(2) {
[0]=>
string(11) "<i>como</i>"
[1]=>
&array(2) {
  [0]=>
  string(11) "<b>hola</b>"
  [1]=>
  string(5) "hello"
}
}
</pre>

any clues?

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux