3v4l.org

run code in 300+ PHP versions simultaneously
<?php class F extends php_user_filter { public function onCreate() { echo 'filter onCreate' . PHP_EOL; return true; } public function onClose() { echo 'filter onClose' . PHP_EOL; } public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $bucket->data = strtoupper($bucket->data); $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } echo 'filtered ' . ($consumed ? $consumed : 0) . ' bytes'; if ($closing) { echo ' and closing.'; } else { echo '.'; } if (feof($this->stream)) { echo ' Stream has reached end-of-file.'; } echo PHP_EOL; return PSFS_PASS_ON; } } stream_filter_register('f', 'F'); $str = str_repeat('a', 8320); echo 'tmpfile()' . PHP_EOL; $f1 = tmpfile(); fwrite($f1, $str); fseek($f1, 0, SEEK_SET); stream_filter_append($f1, 'f', STREAM_FILTER_READ); echo stream_get_contents($f1) . PHP_EOL; fclose($f1); echo PHP_EOL . PHP_EOL; echo 'php://temp' . PHP_EOL; $f2 = fopen('php://temp', 'r+b'); fwrite($f2, $str); fseek($f2, 0, SEEK_SET); stream_filter_append($f2, 'f', STREAM_FILTER_READ); echo stream_get_contents($f2) . PHP_EOL; fclose($f2); echo PHP_EOL . PHP_EOL; echo 'php://memory' . PHP_EOL; $f3 = fopen('php://memory', 'r+b'); fwrite($f3, $str); fseek($f3, 0, SEEK_SET); stream_filter_append($f3, 'f', STREAM_FILTER_READ); echo stream_get_contents($f3) . PHP_EOL; fclose($f3); echo PHP_EOL;

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.3.60.0130.00718.55
8.3.50.0080.00818.17
8.3.40.0140.01019.04
8.3.30.0120.00418.99
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0000.01026.16
8.2.180.0090.00625.92
8.2.170.0130.00919.04
8.2.160.0070.00722.96
8.2.150.0050.00525.66
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0050.00321.11
8.2.110.0040.00419.48
8.1.280.0100.00625.92
8.1.270.0040.00423.99
8.1.260.0070.00726.35
8.1.250.0080.00028.09
8.1.240.0080.00019.26
7.4.90.0130.01316.51
7.4.80.0080.01216.57
7.4.70.0110.00816.71
7.4.60.0210.00016.63
7.4.50.0210.00016.74
7.4.40.0070.01016.45
7.4.30.0060.01316.61
7.4.20.0160.00316.54
7.4.10.0120.00616.59
7.4.00.0040.01316.77
7.3.210.0090.00916.56
7.3.200.0140.00416.62
7.3.190.0110.00716.52
7.3.180.0150.00416.58
7.3.170.0090.01016.65
7.3.160.0140.00316.35
7.3.150.0110.00916.58
7.3.140.0110.00716.66
7.3.130.0120.00616.57
7.3.120.0070.01116.56
7.3.110.0120.00716.73
7.3.100.0070.01016.67
7.3.90.0110.00716.60
7.3.80.0030.01516.74
7.3.70.0100.01016.47
7.3.60.0090.01216.43
7.3.50.0090.01316.57
7.3.40.0180.00016.45
7.3.30.0150.00916.54
7.3.20.0120.00816.55
7.3.10.0150.00316.26
7.3.00.0150.00918.14
7.2.330.0160.00416.64
7.2.320.0120.01016.68
7.2.310.0130.00616.91
7.2.300.0190.00016.78
7.2.290.0080.01116.87
7.2.280.0080.01216.87
7.2.270.0150.00816.66
7.2.260.0150.00416.84
7.2.250.0090.01116.71
7.2.240.0110.00616.89
7.2.230.0150.00316.84
7.2.220.0030.01416.56
7.2.210.0030.01516.97
7.2.200.0170.00316.64
7.2.190.0160.00716.71
7.2.180.0090.00916.73
7.2.170.0100.01116.86
7.2.160.0160.00516.96
7.2.150.0170.01016.80
7.2.140.0280.00018.49
7.2.130.0120.01118.41
7.2.120.0090.01218.50
7.2.110.0080.01118.54
7.2.100.0070.01318.54
7.2.90.0120.01618.57
7.2.80.0160.01318.56
7.2.70.0130.00718.35
7.2.60.0160.01018.54
7.2.50.0140.00718.59
7.2.40.0100.01018.38
7.2.30.0120.00918.46
7.2.20.0220.00018.41
7.2.10.0140.00618.43
7.2.00.0030.02618.52
7.1.330.0970.01315.86
7.1.320.0080.00815.75
7.1.310.0990.00015.93
7.1.300.0030.01715.79
7.1.290.0110.00815.70
7.1.280.0060.01215.82
7.1.270.0120.01215.72
7.1.260.0090.01517.36
7.1.250.0100.01017.34
7.1.240.0090.00917.33
7.1.230.0090.00917.38
7.1.220.0090.00917.27
7.1.210.0150.00317.35
7.1.200.0070.01017.48
7.1.190.0110.00717.51
7.1.180.0130.00617.37
7.1.170.0120.01517.27
7.1.160.0150.00717.36
7.1.150.0040.01317.55
7.1.140.0150.00417.35
7.1.130.0130.00617.39
7.1.120.0120.01217.24
7.1.110.0090.01217.40
7.1.100.0290.01017.52
7.1.90.0130.01017.21
7.1.80.0130.00617.55
7.1.70.0040.01617.42
7.1.60.0040.01517.27
7.1.50.0100.01017.29
7.1.40.0180.00917.38
7.1.30.0170.00317.41
7.1.20.0160.00517.54
7.1.10.0140.00617.27
7.1.00.0060.01217.48
7.0.330.0240.00817.13
7.0.320.0240.00616.91
7.0.310.0230.01017.22
7.0.300.0300.00416.91
7.0.290.0190.01516.90
7.0.280.0240.00917.09
7.0.270.0280.00616.96
7.0.260.0210.01617.07
7.0.250.0250.00917.05
7.0.240.0310.00617.09
7.0.230.0260.00717.21
7.0.220.0290.00817.09
7.0.210.0280.01117.00
7.0.200.0240.00617.07
7.0.190.0220.00817.27
7.0.180.0220.00816.99
7.0.170.0230.00917.19
7.0.160.0170.01316.95
7.0.150.0160.01617.05
7.0.140.0240.00917.05
7.0.130.0210.01217.00
7.0.120.0220.00517.10
7.0.110.0300.00417.09
7.0.100.0220.01017.23
7.0.90.0200.01717.25
7.0.80.0230.01316.99
7.0.70.0310.00817.14
7.0.60.0280.01117.07
7.0.50.0270.00917.09
7.0.40.0330.00616.88
7.0.30.0280.00317.17
7.0.20.0260.00717.07
7.0.10.0300.00617.04
7.0.00.0230.01017.17
5.6.400.0190.01216.43
5.6.390.0160.01616.02
5.6.380.0220.00815.98
5.6.370.0240.01416.28
5.6.360.0270.00716.24
5.6.350.0210.01316.23
5.6.340.0200.01316.09
5.6.330.0300.00416.23
5.6.320.0190.01616.05
5.6.310.0270.00616.14
5.6.300.0150.01516.07
5.6.290.0320.00316.09
5.6.280.0190.01016.08
5.6.270.0230.01015.89
5.6.260.0220.01116.21
5.6.250.0200.01616.28
5.6.240.0250.00916.31
5.6.230.0220.01116.24
5.6.220.0290.01116.09
5.6.210.0160.01615.97
5.6.200.0230.01215.95
5.6.190.0190.01316.15
5.6.180.0220.00716.05
5.6.170.0170.01415.91
5.6.160.0220.01116.14
5.6.150.0260.00716.09
5.6.140.0190.01516.24
5.6.130.0250.00816.33
5.6.120.0220.00815.87
5.6.110.0260.00615.98
5.6.100.0310.00616.11
5.6.90.0190.01515.93
5.6.80.0160.01616.17
5.6.70.0160.01515.93
5.6.60.0150.01915.97
5.6.50.0200.01315.89
5.6.40.0170.01716.02
5.6.30.0270.00615.98
5.6.20.0180.01515.90
5.6.10.0190.01415.98
5.6.00.0230.01316.10
5.5.380.0150.01516.02
5.5.370.0200.01215.95
5.5.360.0290.01315.95
5.5.350.0310.00315.93
5.5.340.0180.01516.02
5.5.330.0210.01215.83
5.5.320.0180.01515.93
5.5.310.0240.00715.96
5.5.300.0260.00716.00
5.5.290.0150.02016.00
5.5.280.0250.00915.84
5.5.270.0220.01316.19
5.5.260.0240.01216.04
5.5.250.0230.00915.97
5.5.240.0230.01216.07
5.5.230.0170.01415.89
5.5.220.0220.00915.84
5.5.210.0250.00916.07
5.5.200.0240.01015.91
5.5.190.0290.01115.92
5.5.180.0220.01716.02
5.5.170.0160.01616.06
5.5.160.0270.00816.02
5.5.150.0190.01116.09
5.5.140.0180.01216.08
5.5.130.0230.00915.94
5.5.120.0240.00515.74
5.5.110.0160.01216.02
5.5.100.0130.01815.93
5.5.90.0190.01316.02
5.5.80.0350.00515.84
5.5.70.0220.01416.00
5.5.60.0190.01116.01
5.5.50.0220.01115.88
5.5.40.0220.00716.08
5.5.30.0230.00916.01
5.5.20.0210.00916.01
5.5.10.0190.01115.79
5.4.450.0160.01012.98
5.4.440.0160.00613.13
5.4.430.0180.01112.80
5.4.420.0190.00813.12
5.4.410.0140.01212.77
5.4.400.0250.00412.80
5.4.390.0140.00912.90
5.4.380.0120.01212.83
5.4.370.0230.00312.75
5.4.360.0210.00312.69
5.4.350.0150.00912.69
5.4.340.0130.01012.87
5.4.330.0160.00812.87
5.4.320.0150.01112.79
5.4.310.0110.01413.01
5.4.300.0150.00812.93
5.4.290.0170.00712.93
5.4.280.0170.01512.91
5.4.270.0090.01212.97
5.4.260.0100.01512.90
5.4.250.0130.01012.98
5.4.240.0150.01213.00
5.4.230.0230.00612.97
5.4.220.0150.00812.85
5.4.210.0200.00612.70
5.4.200.0160.00812.89
5.4.190.0150.00912.77
5.3.290.0230.00413.53

preferences:
48.39 ms | 401 KiB | 5 Q