exTrim() -- Enhanced trim() to support array

/**
* Enhanced trim() to support array
* @author Wilson Zeng
*/
function exTrim($mixed, $removeEmptyString = FALSE){
if(is_array($mixed)){
foreach($mixed as $index => &$item){
$item = exTrim($item);
if($removeEmptyString && $item === ''){
array_splice($mixed, $index, 1);
}
}
return $mixed;
}else{
return trim($mixed);
}
}

你可能感兴趣的:(array)