[TYPO3-core] t3lib_div::trimExplode clean up

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Mon Sep 10 22:18:45 CEST 2007


Wolfgang Klinger schrieb:
> 
> *hiya!*
> 
> On Sep 10, 2007, at 4:04 PM, Dmitry Dulepov [typo3] wrote:
>> function trimExplode($delim, $string, $onlyNonEmptyValues=0)    {
>>     $array = explode($delim, $string);
>>     if ($onlyNonEmptyValues) {
>>         $new_array = array();
>>         foreach($array as $index => $value) {
>>             $value = trim($value);
>>             if ($value != '') {
>>                 $new_array[] = $value;
>>             }
>>         }
>>         return $new_array;
>>     }
>>     foreach($array as $key => &$value) {
>>         $value = trim($value);
>>     }
>>     return $array;
>> }
> 
> and why do you use foreach($array as $index => $value)
> instead of just foreach($array as $value)
> as $index is never used anyway
> (the same with the other foreach)?

Done.

Masi


More information about the TYPO3-team-core mailing list