I am having following two-dimensional array as follows..
array(
0 => array(
0 => 'India',
1 => '91'
),
1 => array(
0 => 'Australia',
1 => '1'
),
2 => array(
0 => 'India',
1 => '20'
),
3 => array(
0 => 'Iraq',
1 => '10'
),
4 => array(
0 => 'Australia',
1 => '3'
),
5 => array(
0 => 'Kuweit',
1 => '14'
)
)
I want to take same inner array values if any exist and merge so that should be added.. So i want to get that array into following array.
array(
0 => array(
0 => 'India',
1 => 111
),
1 => array(
0 => 'Australia',
1 => 4
),
2 => array(
0 => 'Iraq',
1 => 10
),
3 => array(
0 => 'Kuweit',
1 => 14
)
)
How to get this array?
(int)casts, and since your array is zero-index based - there is no need to use theX => Ysyntax. If you remove those, the code will much more readable and likely to attract an answer.