Welcome Guest, Not a member yet? Register   Sign In
[solved] array modication during a foreach loop
#4

[eluser]mironcho[/eluser]
As of php5 you can use foreach value as reference:
Code:
foreach($eventlist as &$item):
but you have to unset $item manually after loop finishes.
Better way to do this is by using index as xwero has shown or by using foreach key functionality:
Code:
foreach($eventlist as $key => $item):
so you can use $key as index to adjust the $eventlist array ($eventlist[$key])


Messages In This Thread
[solved] array modication during a foreach loop - by El Forum - 03-01-2008, 02:43 PM
[solved] array modication during a foreach loop - by El Forum - 03-01-2008, 03:16 PM
[solved] array modication during a foreach loop - by El Forum - 03-01-2008, 03:43 PM
[solved] array modication during a foreach loop - by El Forum - 03-01-2008, 03:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB