多维数组:每个记录都有一个标题和数组,其中包含星期几作为键和值。我正在尝试将这些值插入现有数组的星期几(基于键)。 代码:
foreach($records as $rec)
{
$row = array(
'title' => $rec['title'],
'Monday' => '',
'Tuesday'=> '',
'Wednesday'=> '',
'Thursday' =>'',
'Friday' => '');
foreach($rec['dates'] as $dtow)
{
$dow = explode(' ', $dtow)[0];
$value = explode(' ', $dtow)[1];
if($dow....blah blah that's where I'm getting lost...
}
$data[] = $row;
}
任何建议都将受到赞赏。
EDITED: 对不起,那可能更好......
Event || Monday || Tuesday || Wednesday || Thursday || Friday
Bthd || 12:00 || || 14:30 || ||
Prty || || 18:45 || 17:30 || || 14:15
Wdng || 9:00 || || || 13:30 ||