I have created 2 array, I'm trying to show my first array to another array. So I used foreach statement so I can show each value in my 2nd array like this
$first = array(
'12:00 AM',
'1:00 AM',
'2:00 AM',
'3:00 AM',
'4:00 AM',
'5:00 AM',
'6:00 AM',
'7:00 AM',
'8:00 AM',
'9:00 AM',
'10:00 AM',
'11:00 AM'
);
$2nd = array('body' =>array(),);
foreach ($first as $value) {
$2nd['body'] = $value;
}
echo json_encode($2nd); ?>
The problem is only the 11:AM is showing.
$2ndyou cant start your variable name using number