I need to use Json array in the php code. The problem is that I'm in a for loop and need to separate the array in 2 and then want to merge it. but so far it didn't work. I use it to have a graph (jqxChart).
Here is my code
for($i = 0; $i < $nb; $i++){
if ($i%2 == 1){
$time[$i] = (hexdec($hour[$i]));
$orders1[] = array(
'OrderDate' => $time[$i],
);
}else{
$hour[$i] = $hour[$i] + 1;
$orders2[] = array(
'ProductName' => $hour[$i],
);
}
}
$orders[] = array_merge_recursive( $orders1[], $orders2[] );
}
echo json_encode($orders);
Thanks
$orders = array_merge($orders1, $orders2)
? – Ja͢ck Aug 13 '13 at 2:47