php如何传递数组给函数处理并返回

2024-12-23 05:51:46
推荐回答(2个)
回答1:

public function cleanSpace($trimArr){
foreach($trimArr as $key=>$val){
if($val != ""){
$trimArr[$key] = trim($val);
}
}
return $trimArr;
}

回答2:

一样的传法
public function cleanSpace($trimArr){
foreach($trimArr as $key=>$val){
if($val != ""){
$trimArr[$key] = trim($val);
}
}
return $trimArr;
}