i want to create a table where first column have timing in below style
timing | user1 | user2 | user3
-------------------------------
9 AM | | |
10 AM | | |
. | | |
. | | |
. | | |
6 PM | | |
7 PM | | |
is it possible to use range() for creating timing list, if yes then please tell me , or if not then suggest me better method.
UPDATE:
when i use range(strtotime('9 AM'),strtotime('7 PM'),86400) it returns bool(false)
Thanks always. m i applying wrong way?
Can’t do that with
rangealone, but you can dowhich would give
Your approach would work too, if you take one hour for step instead of one day:
but keep in mind that it is much quicker to just have an an array with these values hardcoded somewhere instead of calculating them on the fly each time you need them.
And of course you can also use
DateInterval. Have a look around StackOverflow for examples.