[TYPO3-core] t3lib_div::trimExplode clean up

Wolfgang Klinger wolfgang at stufenlos.net
Mon Sep 10 16:11:36 CEST 2007


*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)?


bye
Wolfgang

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070910/c3fb7f41/attachment.pgp 


More information about the TYPO3-team-core mailing list