PHP - Need help with some string functions

Fieliakitpase

New Member
I am trying to write a script to pull schedule data out of a database used at work.The employees working times are stored daily as a string like this\[code\]000000000000000000000000000000001111111111111111111111111111111111111111000000000000000000000000\[/code\]Every character represents 15 min. The first character space is 12:00 AM second is 12:15 AM and so on....The example above the employee works 8:00 - 6:00.I created an array like this for every character position.\[code\]$time[0] = "12:00";$time[1] = "12:15";$time[2] = "12:30";$time[3] = "12:45";$time[4] = "1:00";$time[5] = "1:15";$time[6] = "1:30";$time[7] = "1:45";$time[8] = "2:00";\[/code\]and I can display the employees time like this \[code\]echo $time[strpos($string, '1')] . "-" . $time[strpos($string, '0', strpos($string, '1'))];\[/code\]but I cannot figure out how to make this work if someone has a split shift, such as 9:30 - 2:00 / 4:00 - 7:00\[code\]000000000000000000000000000000000000001111111111111111110000000011111111111110000000000000000000\[/code\]Sorry if my English is poor.Thanks
 
Back
Top