3v4l.org

run code in 300+ PHP versions simultaneously
<?php //ini_set('memory_limit','40M'); $m0 = memory_get_usage(); for ($i=0;$i<5000;++$i){ $context = stream_context_create(array('socket'=>array('backlog'=>511))); $server = @stream_socket_server( 'tcp://127.1.1.1:0', $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context ); if ($server !== false) { fclose($server); } unset($server); unset($context); unset($errno); unset($errstr); } $m1 = memory_get_usage(); echo ($m1-$m0)/1048576,' MB allocated',PHP_EOL; $cycles = gc_collect_cycles() + gc_collect_cycles(); echo 'Ran ', $cycles, ' GC Cycles', PHP_EOL;
Output for 8.2.5 - 8.2.11
0.00061798095703125 MB allocated Ran 0 GC Cycles
Output for 8.2.0 - 8.2.4
4.4503860473633 MB allocated Ran 0 GC Cycles
Output for 8.1.18 - 8.1.24
0.00060272216796875 MB allocated Ran 0 GC Cycles
Output for 8.1.0 - 8.1.17
4.7003707885742 MB allocated Ran 0 GC Cycles
Output for 8.0.1 - 8.0.30
4.662223815918 MB allocated Ran 0 GC Cycles

preferences:
79.3 ms | 411 KiB | 5 Q