I have the line
if( getdate($start_time)['hours'] == 0 ){
and I am getting
Parse error: syntax error, unexpected '['
But if I change the line to
$start_time_as_date = getdate($start_time);
if( $start_time_as_date['hours'] == 0 ){
I don’t get an error. Do I always have to save an array to a variable to access its data? Or is there some way to make the first line work?
Yes you do. PHP does not allow you to access an array return value in that way.