3v4l.org

run code in 300+ PHP versions simultaneously
<?php // makes a big map $map = []; for($a = 0; $a < 55555; $a++){ $map["key" . $a] = (object)(array)["x" => $a]; } // empty the map (or partially empty it) for($a = 0; $a < 55555; $a++){ unset($map["key" . $a]); } // at this point $map's length is nexPow2(55555), even if it is empty $om = memory_get_usage(); echo $om . "\n"; (function(array $map){ $map["sup"] = "copy"; // copy on write allocates another nexPow2(55555) array, // rather than starting with a small one $nm = memory_get_usage(); echo $nm . "\n"; })($map);

Abusive script

This script was stopped while abusing our resources

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.100.3000.05341.21
7.2.92.5450.02637.49
7.2.81.0320.03241.25
7.2.70.9390.05241.45
7.2.62.4870.01322.29
7.2.50.1580.06141.61
7.2.40.5050.05241.69
7.2.32.3790.02320.39
7.1.221.7310.05640.55
7.1.211.1890.03640.33
7.1.202.4890.01622.52
7.1.191.6400.04040.64
7.1.181.1680.07540.50
7.1.170.7740.06240.71
7.1.162.7250.02229.42
7.1.152.4830.00318.96
5.6.380.0110.00613.69

preferences:
39.11 ms | 403 KiB | 5 Q