3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Leak { static protected function &leaked(array &$array = null) { $array = array('one'); return $array; } public function toLeaked($array = null) { $array = static::leaked($array); return $array; } public function testLeak() { echo "memory before loop: " . memory_get_usage(true) . PHP_EOL; for ($i = 0; $i < 20000; $i++) { $leak = $this->toLeaked(); } gc_collect_cycles(); echo "memory after loop: " . memory_get_usage(true) . PHP_EOL; } } $leak = new Leak(); $leak->testLeak();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0000.01319.45
7.1.70.0060.00317.23
7.1.60.0070.00717.32
7.1.50.0060.01317.00
7.1.10.0170.07322.34
7.1.00.0100.06722.64
7.0.200.0130.01016.88
7.0.140.0370.06728.13
7.0.130.0400.06028.34
7.0.120.0230.06728.41
7.0.110.0370.07028.35
7.0.100.0300.05328.49
7.0.90.0230.06728.45
7.0.80.0200.05728.47
7.0.70.0270.06028.40
7.0.60.0300.06728.42
7.0.50.0400.04728.34
7.0.40.0200.06728.50
7.0.30.0270.06328.53
7.0.20.0500.06028.49
7.0.10.0230.07728.44
7.0.00.0170.06328.52

preferences:
39.07 ms | 403 KiB | 5 Q