Here is a 3d array:
Array (
[0] => Array ( [item] => audcad [time] => 09-17 [acc_profit] => -3.23 )
[1] => Array ( [item] => audusd [time] => 10-17 [acc_profit] => -3.29 )
[2] => Array ( [item] => audnzd [time] => 10-17 [acc_profit] => 4.94 )
[3] => Array ( [item] => audusd [time] => 10-17 [acc_profit] => -2.24 )
[4] => Array ( [item] => audnzd [time] => 10-17 [acc_profit] => -3.26 )
[5] => Array ( [item] => audcad [time] => 10-17 [acc_profit] => -1.74 )
..
..
[43] => Array ( [item] => audusd [time] => 11-18 [acc_profit] => -1.57 )
[44] => Array ( [item] => audusd [time] => 12-18 [acc_profit] => -1.76 )
)
I want to insert this array:
Array ( [item] => audcad [time] => 07-17 [acc_profit] => 0.00 )
to the beginning of the first one.
The second array was created in a “hybridization” of the [item] element of the first array with [time] and [acc_profit] of another 2d array.
Here is what I did:
//Get the 3D aray data for family line graph
$data_l = get_all_family_profit($coin);
//Get the data for all couples line graph to get deposit data which is the first item in array
//$items _l is a 2D array
$items_l = get_all_profit();
//Create a new 3D array and insert
$deposit_date_primer = $items_l[0];
$deposit_date['item'] = $data_l[0]['item'];
$deposit_date['time'] = $deposit_date_primer['time'];
$deposit_date['acc_profit'] = $deposit_date_primer['profit'];
$data_l = array_unshift($data_l, $deposit_date);
something dousn;t work well because when I transform it to a JSON array using
<?php echo json_encode($data_l); ?> to use it in javascript the code using it doesn't work.what do I do wrong?