I have a sorted array of keys and value like
Array
(
[1] => Array
(
[value] => 65
......
)
[0] => Array
(
[value] => 65
)
[5] => Array
(
[value] => 35
)
[4] => Array
(
[value] => 3
)
[2] => Array
(
[value] => 0
)
[3] => Array
(
[value] => 0
)
)
I search for simple algorithm that run over this array and return array of places
like :
places['1'] = keys => array(1,0), value => 65
places['2'] = keys => array(5), value => 35
places['3'] = keys => array(4), value => 3
places['4'] = keys => array(2,3), value => 0
so in the first place we have key 1 + 0, and the value is 65
and so on…….
I try to loop with foreach and add a lot of if conditions,
I search something simple
thanks
I assume you mean
places['4']in the last line. If so, this should do it (otherwise you have to explain why there is a2;)):