<?php
class Test
{
public function trimArray($params){
if (!is_array($params))
return trim($params);
return array_map([__CLASS__,'trimArray'], $params);
}
}
$test = new Test();
$arr = [' s',' sfsdfsdf'];
var_dump($arr);
$res = $test->trimArray($arr);
var_dump($res);