[TYPO3-core] RFC: Bug #10094: Use foreach instead of while-list-each constructs in t3lib_TCEmain

Martin Kutschker masi-no at spam-typo3.org
Sun Jan 11 14:14:46 CET 2009


Oliver Hader schrieb:
> This is a SVN patch request.
> 
> Problem:
> In t3lib_TCEmain there are a lot of while(list(...)=each(...)) loops
> that should be replaced by foreach loops.
> 
> Solution:
> Use foreach loops...
> 
> Comments:
> The patch just changes the loops, remove superfluous global()
> definitions and code that could be written easier in this context.

+1 from reading, but I wonder if this kind of changes are any faster:

-2460 while(list($table,) = each($this->cmdmap)) {
+2453 foreach (array_keys($this->cmdmap) as $table) {

We get an additional array operation.

How about using a dummy value:

-2460 while(list($table,) = each($this->cmdmap)) {
+2453 foreach ($this->cmdmap as $table => &$dummy) {


Masi


More information about the TYPO3-team-core mailing list