How to get current time in milliseconds in PHP?
Hello everyone! I just started learning PHP and came across this task: I need to measure script execution time with millisecond precision. I know that PHP has the time() function, which returns the current timestamp in seconds, but that's not enough — I need milliseconds.
I tried using microtime(), but I didn't quite understand how to convert it into a convenient format. Here's what I wrote:
```php
```
This works, but it only gives seconds. I need something like: "Execution time: 0.023 seconds" or just the value in milliseconds, for example 23 ms.
I've heard that you can use microtime(true), but I don't understand how to work with it correctly. Also int
No answers yet.
Log in to leave an answer
Blogs