X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/ec3d2d7525c17027d6012af80d97ad4f798d8b96..2a40a485f0acc08ecc8f0b03babee58401b4158d:/t3lib/class.t3lib_div.php diff --git a/t3lib/class.t3lib_div.php b/t3lib/class.t3lib_div.php index c5c19dd45581..745398987256 100755 --- a/t3lib/class.t3lib_div.php +++ b/t3lib/class.t3lib_div.php @@ -1451,15 +1451,21 @@ class t3lib_div { * @return array Exploded values */ function trimExplode($delim, $string, $onlyNonEmptyValues=0) { - $temp = explode($delim,$string); - $newtemp=array(); - while(list($key,$val)=each($temp)) { - if (!$onlyNonEmptyValues || strcmp('',trim($val))) { - $newtemp[]=trim($val); + $array = explode($delim, $string); + if ($onlyNonEmptyValues) { + foreach($array as $index => &$value) { + $value = trim($value); + if ($value == '') { + unset($array[$index]); + } + } + $array = array_merge($array); + } else { + foreach($array as $key => &$value) { + $value = trim($value); } } - reset($newtemp); - return $newtemp; + return $array; } /**