数组处理
程序员文章站
2024-03-04 09:42:05
...
1、递归去除参数两边空格
$sweet = ['a' => ' apple', 'b' => ' banana '];
$fruits = ['sweet' => $sweet, 'sour' => 'lemon'];
array_walk_recursive($fruits, function(&$value){$value = trim($value);}); //去前后空格
var_dump($fruits);