3v4l.org

run code in 300+ PHP versions simultaneously
<?php $records = [ 't' => new WeakMap(), ]; class X { public array $id; public function __destruct() { var_dump('Cleaning up: ' . json_encode($this->id)); } } // Treat this as usages external to Records itself. $external = []; (function () use (&$records, &$external) { foreach (range(0, 3) as $i) { $x = new X(); $x->id = [$i]; $records['t'][$x] = WeakReference::create($x); $external[] = $x; } })(); $finder = function (array $find) use (&$records) { foreach ($records['t'] as $object => $ref) { if ($object->id == $find) { return $object; } } }; var_dump('Found object:', $finder([2])); var_dump('Found object:', $finder([99])); var_dump(count($records['t'])); var_dump('Removing external 2 (should auto-destruct)'); unset($external[2]); var_dump(count($records['t'])); var_dump('Exiting...');

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)
8.4.120.0110.01022.12
8.4.110.0120.00918.95
8.4.100.0160.00617.73
8.4.90.0130.00717.63
8.4.80.0300.01218.64
8.4.70.0420.00917.48
8.4.60.0440.00617.71
8.4.50.0410.00917.45
8.4.40.0440.00917.52
8.4.30.0530.00717.58
8.4.20.0270.00517.56
8.4.10.0230.00517.58
8.3.250.0110.00817.14
8.3.240.0060.00316.55
8.3.230.0100.01016.54
8.3.220.0270.01118.76
8.3.210.0380.00616.84
8.3.200.0390.01116.84
8.3.190.0260.00516.84
8.3.180.0200.00316.84
8.3.170.0170.00616.84
8.3.160.0270.00916.84
8.3.150.0160.00716.84
8.3.140.0320.00616.84
8.3.130.0340.01116.84
8.3.120.0350.01116.84
8.3.110.0340.00916.84
8.3.100.0420.00716.84
8.3.90.0430.00816.84
8.3.80.0390.01216.84
8.3.70.0300.00516.84
8.3.60.0210.00216.84
8.3.50.0190.00416.84
8.3.40.0330.01017.59
8.3.30.0350.00417.46
8.3.20.0230.00617.75
8.3.10.0180.00117.72
8.3.00.0070.00419.28
8.2.290.0120.00419.26
8.2.280.0300.01016.84
8.2.270.0370.00616.84
8.2.260.0360.00616.84
8.2.250.0300.01016.84
8.2.240.0320.00616.84
8.2.230.0330.00616.84
8.2.220.0350.00816.84
8.2.210.0380.00416.84
8.2.200.0370.00616.84
8.2.190.0320.01016.84
8.2.180.0290.00716.84
8.2.170.0210.00317.68
8.2.160.0340.00917.64
8.2.150.0370.00817.51
8.2.140.0380.00917.43
8.2.130.0400.00717.71
8.2.120.0300.01017.41
8.2.110.0250.00617.53
8.2.100.0390.00717.44
8.2.90.0330.00817.57
8.2.80.0230.00617.62
8.2.70.0380.00917.38
8.2.60.0330.01217.43
8.2.50.0380.01017.32
8.2.40.0320.00617.69
8.2.30.0300.00717.27
8.2.20.0390.00417.51
8.2.10.0160.00317.55
8.2.00.0220.00117.52

preferences:
33.43 ms | 403 KiB | 5 Q