I've looked at other questions/answers but I'm not fully understanding it. Furthermore, I haven't found one asking my exact question.
I have 7 arrays storing the start and end times for a business. My PHP program checks for the current day and matches it with the start end time for that day. So right now I have 7 if
statements similar to this:
if (date(l) == 'Sunday') {
$start = $SundayAccountingHours['start'];
$end = $SundayAccountingHours['end'];
}
What I want to do is clean up the code. So maybe I could have something like
$start = ${$today}.AccountingHours['start'];
$end = ${$today}.AccountingHours['end'];
How can I make this work? Using the above example I'm getting this: Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\Dev.php on line 22 where line 22 is $start is defined. I can't take out the stuff in the brackets because THAT'S the information I need to really get to.
If you can't tell, I'm still novice at PHP so any help will be appreciated.
Thanks!