[TYPO3-core] RFC: Feature #2883 / t3lib_div::trimExplode

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Mon Sep 10 11:02:00 CEST 2007


Dmitry Dulepov [typo3] schrieb:
> Hi!
> 
> We have got a problem :(
> 
> Martin Kutschker wrote:
>>     function trimExplodeMASI($delim, $string, $onlyNonEmptyValues=0) {
>>         $array = explode($delim, $string);
>>         if ($onlyNonEmptyValues) {
>>             foreach($array as $index => &$value) {
>>                 $value = trim($value);
>>           if ($value == '') {
>>             unset($array[$index]);
> 
> Line "$value = trim($value);" does not change $array[$index] since 
> "unset" was called. See image #1 and values of $value and $array[$index] 
> at bottom of the image. At least it is so on PHP 5.2.1. Array always 
> stays as is after the first unset line.

It did work with my unit tests :-(

Masi


More information about the TYPO3-team-core mailing list