3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Lock { function __destruct() { echo "***lock released now***\n"; } } class LockedFile { private $lock; function __construct(string $path) { $this->lock = new Lock(); } } class LineReader { function __construct(private LockedFile $file) {} function readLines() { } } function process_lines(LineReader $reader) { throw new Exception("readLines"); } function process_file(string $path): string { try { $file = new LockedFile($path); $reader = new LineReader($file); process_lines($reader); } catch (Exception $e) { // release file echo "unsetting \$file, \$reader...\n"; unset($file, $reader); // $file is still referenced via $e->getTrace()[0]['args'][0]->file 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.0030.00014.05
8.4.140.0360.00817.96
8.4.130.0330.01317.74
8.4.120.0370.00917.86
8.4.110.0340.01117.76
8.4.100.0340.01117.84
8.4.90.0380.01017.82
8.4.80.0350.00918.08
8.4.70.0380.00717.96
8.4.60.0430.00817.83
8.4.50.0450.01217.84
8.4.40.0400.01117.81
8.4.30.0400.01117.63
8.4.20.0370.01117.54
8.4.10.0380.01117.65
8.3.270.0370.00516.64
8.3.260.0360.00816.43
8.3.250.0340.00916.29
8.3.240.0360.00816.71
8.3.230.0330.01216.62
8.3.220.0370.00816.69
8.3.210.0360.00716.71
8.3.200.0380.01016.60
8.3.190.0330.01116.56
8.3.180.0340.00916.74
8.3.170.0370.00916.48
8.3.160.0380.00816.30
8.3.150.0370.00916.62
8.3.140.0360.01016.47
8.3.130.0300.01116.93
8.3.120.0340.00916.82
8.3.110.0320.00916.47
8.3.100.0400.01016.34
8.3.90.0360.01216.43
8.3.80.0360.01216.53
8.3.70.0370.00916.39
8.3.60.0390.00716.83
8.3.50.0360.00916.77
8.3.40.0420.00617.65
8.3.30.0280.01117.58
8.3.20.0270.00917.41
8.3.10.0310.00617.68
8.3.00.0320.01017.19
8.2.290.0300.00716.82
8.2.280.0360.00616.46
8.2.270.0330.01116.41
8.2.260.0330.00616.44
8.2.250.0290.00916.73
8.2.240.0270.01116.70
8.2.230.0280.01016.37
8.2.220.0330.00616.68
8.2.210.0320.00616.44
8.2.200.0280.01116.42
8.2.190.0310.00716.60
8.2.180.0350.00416.36
8.2.170.0300.01317.68
8.2.160.0330.00717.81
8.2.150.0260.01217.63
8.2.140.0300.00817.46
8.2.130.0310.00817.46
8.2.120.0300.00917.31
8.2.110.0320.00917.39
8.2.100.0320.00617.29
8.2.90.0320.00617.29
8.2.80.0320.00617.54
8.2.70.0330.00517.61
8.2.60.0290.00917.55
8.2.50.0320.00617.44
8.2.40.0340.00417.13
8.2.30.0320.00617.38
8.2.20.0310.00917.13
8.2.10.0290.00817.37
8.2.00.0390.00817.43

preferences:
42.55 ms | 403 KiB | 5 Q