Sure, it's possible. It's just an array. You have several arrays, however. The first array would be $L1, the second $SR1, and then $CL1. Of course, you'd have those all the way up until you needed no more (8 $Lx arrays, 2 $SRx arrays, and 4 $CLx arrays).
Within each array, you'd need to set up a key for each time:
$L1["09:00"] = ""; // 09:00 is open
$L1["11:00"] = "Multimedia Class"; // 11:00, Multimedia has this lab
$L1["12:00"] = "Multimedia Class"; // They have it at 12, as well
And do this for all of them. Of course, you want it dynamic, but we're not there yet.
Where the table has a border is where the last time ends and the next begins. There is no border if something takes up multiple times, so we need to account for this. When we loop through every time in the array, we'll have to check for duplicates in a row:
if ($currentclass != $oldclass) {
// draw a border here
}
Tell me if you get stuck on anything from here, and I'll try to help.