I have slot times booking room like this : 

```
07.00,07.55,08.50,09.45,10.40,11.35,12.30,13.00,13.55,14.50,15.45,16.40,17.35,18.30.

```

This is a booking time example :

Book Time Room A1 :

```
      ==> 1 : 07.00 - 09.45 ~ credit 3
      ==> 2 : 10.40 - 12.30 ~ credit 3
      ==> 3 : 13.00 - 15.45 ~ credit 3

```

note : 1 credit --> 55 minutes

And now I have an array :

Array Book Time :

```
$startBook[0] = 07.00, 
$startBook[1] = 10.40, 
$startBook[2] = 13.00, 
$endBook[0] = 09.45, 
$endBook[1] = 12.30, 
$endBook[2] = 15.45

```

I want to display the table like : ![table](https://i.stack.imgur.com/LthKF.png)

How I can set the colspan dynamically depend on the credit. The credit not always 3, it also can be 2 or 4.

This is the html :

```
<table>
    <tr>
        <td>Room</td>
        <td colspan="" >07.00</td>
        <td colspan="" >07.55</td>
        so on...
    </tr>
    <tr>
        <td>A1</td>
        <td colspan="..."></td>
        <td>09.45</td>
    </tr>
</table>

```