How to get current time in milliseconds in PHP?
time() is in seconds - is there one in milliseconds? The short answer is: $milliseconds = round(microtime(true) * 1000); kennytm Use microtime . This function returns a string separated by a space. The first part is the fractional part of seconds, the second part is the integral part. Pass in true to get as a number: var_dump(microtime()); // string(21) "0.89115400 1283846202" var_dump(microtime(true)); // float(1283846202.89) Beware of precision loss if you use microtime(true) . There is also gettimeofday that returns the microseconds part as an integer. var_dump(gettimeofday()); /* array(4)