3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Lock { function __destruct() { echo "***lock released now***\n"; } } class DummyFileHandler { function lock(string $lock_type): Lock { return new Lock; } function readAll() { throw new DummyFileHandlerException('Uh oh!'); } } class DummyFileHandlerException extends Exception { }; function process_file(string $path): string { try { $file = new DummyFileHandler($path); $lock = $file->lock('shared'); $content = (function (Lock $lock) use ($file) { $local_lock = $lock; unset($lock); return $file->readAll(); })($lock); } catch (DummyFileHandlerException $e) { // release $file and $lock echo "unsetting \$lock...\n"; unset($file, $lock); // but $lock is in fact not yet released, it can be retrieved through the stack trace echo "lock: "; var_dump($e->getTrace()[1]['args'][0]); throw new Exception('Processing failed', previous: $e); } return $content; } process_file('/some/file.txt');

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.150.0020.00114.05
8.4.140.0290.01217.46
8.4.130.0320.00817.71
8.4.120.0380.00717.89
8.4.110.0360.01217.84
8.4.100.0360.00917.77
8.4.90.0280.01617.69
8.4.80.0360.00917.68
8.4.70.0320.01117.99
8.4.60.0380.01417.88
8.4.50.0350.01017.91
8.4.40.0400.00817.67
8.4.30.0430.00617.71
8.4.20.0400.00717.67
8.4.10.0390.00817.73
8.3.270.0380.00616.97
8.3.260.0340.00816.61
8.3.250.0350.00716.57
8.3.240.0330.00816.65
8.3.230.0350.00616.58
8.3.220.0350.00816.70
8.3.210.0340.00716.70
8.3.200.0370.00616.54
8.3.190.0360.00916.74
8.3.180.0390.00716.53
8.3.170.0410.01016.40
8.3.160.0400.00816.69
8.3.150.0350.01016.43
8.3.140.0360.01016.78
8.3.130.0340.00816.65
8.3.120.0310.00816.50
8.3.110.0300.01016.70
8.3.100.0380.01216.83
8.3.90.0410.00916.47
8.3.80.0420.00516.68
8.3.70.0420.00516.88
8.3.60.0380.01016.60
8.3.50.0390.01116.44
8.3.40.0450.00917.34
8.3.30.0320.00917.30
8.3.20.0270.01017.39
8.3.10.0310.00717.59
8.3.00.0210.00717.44
8.2.290.0290.00816.96
8.2.280.0260.01016.55
8.2.270.0300.00816.50
8.2.260.0320.00616.84
8.2.250.0290.01016.72
8.2.240.0300.00916.64
8.2.230.0320.00616.66
8.2.220.0310.00816.73
8.2.210.0250.01416.85
8.2.200.0340.00616.67
8.2.190.0320.01316.39
8.2.180.0290.00816.88
8.2.170.0380.00817.52
8.2.160.0320.00917.85
8.2.150.0320.01017.48
8.2.140.0310.00717.64
8.2.130.0300.00817.50
8.2.120.0310.00917.63
8.2.110.0330.00717.43
8.2.100.0290.00917.38
8.2.90.0300.00817.36
8.2.80.0300.00717.65
8.2.70.0320.00717.44
8.2.60.0310.00717.38
8.2.50.0300.00817.39
8.2.40.0320.00617.64
8.2.30.0300.00917.45
8.2.20.0290.00917.41
8.2.10.0290.01017.57
8.2.00.0400.01017.32

preferences:
41.2 ms | 403 KiB | 5 Q