Hey i want to add to my Plugin a Stopwatch which records the time for example for a Race and output at the end the Time.Can you help me please and explain it. Thankss .
I need to get the time between two moments. For example the time between the beginning of a race and the end of it.
time() (https://PHP.net/time) returns the number of seconds from 1970-1-1 to the current time (the time the code is run). If you record the time() when the race starts, then record the time() when the race ends, then subtract end by start, it is the number of seconds elapsed.
PHP: // Race starts$beginning = time();//Race is running...//Race end$end = time();//Time from $beginning to $end(in sec):$time = $end - $beginning;