[TYPO3-core] RFC: Feature #2883 / t3lib_div::trimExplode
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Fri Sep 7 17:12:14 CEST 2007
Michael Stucki schrieb:
> Martin Kutschker wrote:
>
>>> Thanks so far! I was just wondering if there is a reason for keeping
>>> redundant code inside the function?
>> Speed. The "if ($onlyNonEmptyValues)" needs only to be executed once) and
>> mind the array_merge() which is only necessary (to reindex the array) when
>> $onlyNonEmptyValues is set.
>>
>> Please, don't "beautify". Then we could have lived with the old code.
>
> Ah, I see. However, it would be helpful if there was a comment above these
> lines, because my memory tells me that we clean up stuff like this every
> once in a while.
I've added:
// for two perfomance reasons the loop is duplicated
// a) avoid check for $onlyNonEmptyValues in foreach loop
// b) avoid unnecessary code when $onlyNonEmptyValues is not set
> In case of this function, I agree that it's worth the redundancy.
> However, for most other positions, the general rule should be to avoid that.
Sure. I also dislike redundancy.
Masi
More information about the TYPO3-team-core
mailing list