[RESOLVED] Timer countdown function alteration

Hey everyone - the function discussed in this thread is at the bottom of this post.

What this function does is countdown the value of an HTML table-cell to zero (minus 1 every second) then stop counting that specific cell when it's finished. This works perfectly, the problem is that when it is called AGAIN for a different table-cell, the previous cell starts reducing its value by 2 every second instead of 1. This function supports the Hour:Minute:Second format.

So, how would i make this function so that i can call an infinite number of different table cells, and the previous table cells timers would not be affected (they would still countdown 1 per second as they should)?

Thank you so much. I have been stuck on this problem for 2 weeks and just left my project dormant because of it. This simple problem has struck me from behind and destroyed my passion for the project - please help me get back on track!

-Ollie

This is the code which CALLS the function, where $i is 1-5 inclusive, defined by PHP:

On an unrelated note, I notice you're ending the double quoted string to concatenate $i. You can interpolate variables directly into double quoted and heredoc strings. The PHP code can thus be made more readable:

Both still need a little more error handling to cover cases where the 'data' element doesn't contain a properly formatted time string, and could potentially use an optional 'time' argument so the 'data' element doesn't need to hold a time string.