Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return current Unix timestamp with microseconds
<?php microtime(bool $as_float = false): string|float
<?php     });




    $t = microtime(true);

    $connection->on('close', function () use ($connection, $t, &$bytes) {

        $t = microtime(true) - $t;

        echo '[' . $connection->getRemoteAddress() . ' disconnected after receiving ' . $bytes . ' bytes in ' . round($t, 3) . 's => ' . round($bytes / $t / 1024 / 1024, 1) . ' MiB/s]' . PHP_EOL;
<?php     $t = microtime(true);

    $connection->on('close', function () use ($connection, $t, &$bytes) {

        $t = microtime(true) - $t;

        echo '[' . $connection->getRemoteAddress() . ' disconnected after receiving ' . $bytes . ' bytes in ' . round($t, 3) . 's => ' . round($bytes / $t / 1024 / 1024, 1) . ' MiB/s]' . PHP_EOL;

    });

});
<?php         $this->assertNotNull($listener);

        $socket = stream_socket_server('tcp://127.0.0.1:0');



        $time = microtime(true);

        $listener($socket);

        $time = microtime(true) - $time;
<?php         $time = microtime(true);

        $listener($socket);

        $time = microtime(true) - $time;



        $this->assertLessThan(1, $time);
<?php         $this->assertNotNull($listener);

        $socket = stream_socket_server('tcp://127.0.0.1:0');



        $time = microtime(true);

        $listener($socket);

        $time = microtime(true) - $time;
<?php         $time = microtime(true);

        $listener($socket);

        $time = microtime(true) - $time;



        $this->assertLessThan(1, $time);
<?php         $this->assertNotNull($listener);

        $socket = stream_socket_server('tcp://127.0.0.1:0');



        $time = microtime(true);

        $listener($socket);

        $time = microtime(true) - $time;
<?php         $time = microtime(true);

        $listener($socket);

        $time = microtime(true) - $time;



        $this->assertLessThan(1, $time);