3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sweet = ['a' => 'apple ', 'b' => ' "banana" ']; $array = ['sweet' => $sweet, 'test' => " <a href='test'>Test</a>"]; array_walk_recursive($array, function(&$value) { $value = htmlspecialchars(trim($value)); } ); var_export($array);

preferences:
26.59 ms | 407 KiB | 5 Q