I was trying to add some numbers from two or more arrays to one array. My problem is, that it always adds another index.
Source arrays looks like this:
array(
(int) 0 => array(
'Sale' => array(
'id' => '1',
'market_id' => '1',
'product_ids' => '1,2,3,4,5,6,7,8',
'date_and_time' => '2014-12-28 00:00:00',
'money_spent' => '2344',
'points_given' => '213'
)
),
(int) 1 => array(
'Sale' => array(
'id' => '2',
'market_id' => '1',
'product_ids' => '44,3,32,23,12,32',
'date_and_time' => '2014-12-28 15:25:38',
'money_spent' => '123',
'points_given' => '2'
)
)
)
PHP code that im using to merge arrays and explode numbers from product_ids field
$sales=array();
foreach ($sales_detailed as $sale_detailed): {
$sale_detailed_ids=explode( ',', $sale_detailed['Sale']['product_ids'] );
array_push($sales, $sale_detailed_ids);
} endforeach;
The result is
array(
(int) 0 => array(
(int) 0 => '1',
(int) 1 => '2',
(int) 2 => '3',
(int) 3 => '4',
(int) 4 => '5',
(int) 5 => '6',
(int) 6 => '7',
(int) 7 => '8'
),
(int) 1 => array(
(int) 0 => '44',
(int) 1 => '3',
(int) 2 => '32',
(int) 3 => '23',
(int) 4 => '12',
(int) 5 => '32'
)
)
While i want it to look like this
array(
(int) 0 => array(
(int) 0 => '1',
(int) 1 => '2',
(int) 2 => '3',
(int) 3 => '4',
(int) 4 => '5',
(int) 5 => '6',
(int) 6 => '7',
(int) 7 => '8'
(int) 8 => '44',
(int) 9 => '3',
(int) 10 => '32',
(int) 11 => '23',
(int) 12 => '12',
(int) 13 => '32'
)
)