[TYPO3-core] RFC: Feature Request 6037: Performance tunning in t3lib_div by removing elderly PHP functions

Oliver Hader oh at inpublica.de
Wed Sep 5 10:41:53 CEST 2007


Hi Masi,

Martin Kutschker schrieb:
> Oliver Hader schrieb:
>> A reference operator "&" was missing in revExplode(). I checked again
>> all changed foreach calls for these referencing things and fixed the
>> behaviour you pointed out.
> 
> Did you profile also "foreach ($array as &$key => &$value)"?
> 
> Most loops don't modify the loop arguments and so refernces could be
> used. That is if, they are faster.

The expression "foreach ($array as &$key => &$value)" would mean:
* $value =& $array[$key]
* But where would the $key reference point to?

Anyway I tried this and got the following:
"Fatal error: Key element cannot be a reference"

Another sitation would be this:

$arrayKeys = array_keys($array);
foreach ($arrayKeys as &$key) {
  $value =& $array[$key];
  /* ... */
}

But I doubt that this would be faster in all cases.


olly
-- 
Oliver Hader
http://inpublica.de/


More information about the TYPO3-team-core mailing list