3v4l.org

run code in 300+ PHP versions simultaneously
<?php $segments = [1,2,3,4,5,6,7,8,9,1]; $box_size = 4; $input = 'Loremipsumdolorsitametconsecteturadipiscingeli'; $output = []; function string_to_stream($string) { $in = fopen('php://memory','r+'); fwrite($in, $string); rewind($in); return $in; } $stream = string_to_stream($input); $left_over = ''; while (($segment = array_shift($segments)) !== null) { while (strlen($left_over) < $segment) { $left_over .= fread($stream, $box_size); } $output[] = substr($left_over, 0, $segment); $left_over = substr($left_over, $segment); } if (implode('', $output) === $input) { echo 'Algorithm Correct !' . PHP_EOL . PHP_EOL; } foreach ($output as $v) { echo $v . 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.0140.00416.75
8.3.50.0100.00716.23
8.3.40.0130.00318.75
8.3.30.0150.00618.85
8.3.20.0050.00318.60
8.3.10.0040.00421.72
8.3.00.0080.00020.77
8.2.180.0140.00418.29
8.2.170.0070.00719.08
8.2.160.0070.01022.96
8.2.150.0090.00924.18
8.2.140.0030.00624.66
8.2.130.0030.00621.07
8.2.120.0000.00926.35
8.2.110.0090.00021.07
8.2.100.0120.00017.84
8.2.90.0080.00017.91
8.2.80.0000.00817.97
8.2.70.0070.00318.03
8.2.60.0040.00418.22
8.2.50.0060.00318.22
8.2.40.0070.00020.50
8.2.30.0080.00019.38
8.2.20.0050.00218.19
8.2.10.0050.00218.24
8.2.00.0040.00417.80
8.1.280.0040.01125.92
8.1.270.0000.00822.19
8.1.260.0080.00028.09
8.1.250.0070.00028.09
8.1.240.0060.00320.43
8.1.230.0080.00322.86
8.1.220.0050.00317.78
8.1.210.0030.00618.77
8.1.200.0030.00717.35
8.1.190.0030.00517.23
8.1.180.0050.00318.10
8.1.170.0080.00018.50
8.1.160.0000.00720.59
8.1.150.0030.00520.32
8.1.140.0060.00319.63
8.1.130.0030.00317.75
8.1.120.0000.00717.39
8.1.110.0040.00417.48
8.1.100.0000.00717.36
8.1.90.0040.00417.50
8.1.80.0000.00817.48
8.1.70.0000.00717.37
8.1.60.0060.00317.63
8.1.50.0000.01217.55
8.1.40.0000.01117.49
8.1.30.0000.00917.60
8.1.20.0040.00417.73
8.1.10.0070.00017.51
8.1.00.0040.00417.41
8.0.300.0040.00422.06
8.0.290.0060.00316.75
8.0.280.0030.00318.50
8.0.270.0040.00417.39
8.0.260.0000.00717.23
8.0.250.0080.00017.04
8.0.240.0000.00617.04
8.0.230.0000.00717.07
8.0.220.0030.00316.92
8.0.210.0070.00016.93
8.0.200.0070.00017.06
8.0.190.0030.00616.91
8.0.180.0040.00417.01
8.0.170.0080.00016.96
8.0.160.0000.00816.93
8.0.150.0050.00316.99
8.0.140.0040.00416.96
8.0.130.0050.00013.38
8.0.120.0040.00416.96
8.0.110.0000.00716.79
8.0.100.0030.00316.76
8.0.90.0040.00416.84
8.0.80.0080.00816.92
8.0.70.0040.00416.99
8.0.60.0040.00416.80
8.0.50.0050.00217.02
8.0.30.0120.00617.13
8.0.20.0080.01117.40
8.0.10.0000.00817.04
8.0.00.0090.00816.79
7.4.330.0050.00015.55
7.4.320.0000.00616.46
7.4.300.0060.00016.62
7.4.290.0070.00016.49
7.4.280.0050.00316.63
7.4.270.0070.00016.51
7.4.260.0030.00316.64
7.4.250.0030.00316.39
7.4.240.0040.00416.63
7.4.230.0070.00016.63
7.4.220.0030.00316.36
7.4.210.0080.00816.61
7.4.200.0040.00416.70
7.4.160.0080.01016.44
7.4.150.0160.00917.40
7.4.140.0100.01017.86
7.4.130.0140.00616.49
7.4.120.0120.00516.52
7.4.110.0070.01016.62
7.4.100.0070.01116.74
7.4.90.0100.00716.43
7.4.80.0170.00619.39
7.4.70.0060.01016.47
7.4.60.0090.00616.59
7.4.50.0090.00616.49
7.4.40.0090.01516.22
7.4.30.0030.01316.61
7.4.10.0120.00415.18
7.4.00.0050.01315.08
7.3.330.0030.00313.41
7.3.320.0030.00313.42
7.3.310.0030.00316.41
7.3.300.0030.00316.47
7.3.290.0080.00516.42
7.3.280.0090.01016.39
7.3.270.0030.01417.40
7.3.260.0100.00816.40
7.3.250.0100.00816.49
7.3.240.0120.00816.36
7.3.230.0120.00416.39
7.3.210.0060.01316.54
7.3.200.0090.00916.50
7.3.190.0080.00916.64
7.3.180.0060.00916.66
7.3.170.0070.01016.63
7.3.160.0120.00416.55
7.3.130.0090.00914.70
7.3.120.0080.00814.76
7.3.110.0100.01014.91
7.3.100.0110.00314.86
7.3.90.0000.01115.09
7.3.80.0090.00014.63
7.3.70.0110.00414.98
7.3.60.0110.00414.77
7.3.50.0040.01414.95
7.3.40.0030.00914.62
7.3.30.0150.00014.81
7.3.20.0100.00716.63
7.3.10.0060.00616.72
7.3.00.0070.00716.91
7.2.330.0060.01216.90
7.2.320.0030.01416.67
7.2.310.0060.01316.73
7.2.300.0090.01416.62
7.2.290.0100.01316.74
7.2.260.0090.00915.00
7.2.250.0060.01015.09
7.2.240.0060.00915.22
7.2.230.0060.01014.83
7.2.220.0060.00615.37
7.2.210.0000.01314.69
7.2.200.0000.01015.20
7.2.190.0070.00715.24
7.2.180.0030.00614.79
7.2.170.0030.01015.21
7.2.160.0060.01014.74
7.2.150.0060.00616.61
7.2.140.0000.00917.11
7.2.130.0140.00316.77
7.2.120.0120.00316.90
7.2.110.0000.00917.05
7.2.100.0120.00416.83
7.2.90.0030.01417.02
7.2.80.0110.00416.82
7.2.70.0130.00016.93
7.2.60.0030.01017.04
7.2.50.0100.00317.07
7.2.40.0000.01316.73
7.2.30.0040.01216.73
7.2.20.0110.00716.96
7.2.10.0100.00717.11
7.2.00.0030.01218.23
7.1.330.0120.00315.55
7.1.320.0030.00915.88
7.1.310.0060.00916.05
7.1.300.0000.00915.50
7.1.290.0070.00715.95
7.1.280.0070.01015.84
7.1.270.0060.00615.61
7.1.260.0110.00015.85
7.1.250.0070.00316.01
7.1.240.0030.01015.92
7.1.230.0100.00315.73
7.1.220.0030.00615.79
7.1.210.0040.00915.95
7.1.200.0070.00515.76
7.1.190.0050.00515.88
7.1.180.0060.00815.68
7.1.170.0070.00715.67
7.1.160.0040.00715.60
7.1.150.0140.00015.64
7.1.140.0000.01215.82
7.1.130.0030.00915.92
7.1.120.0070.01015.65
7.1.110.0030.00515.84
7.1.100.0030.01215.55
7.1.90.0040.01115.96
7.1.80.0100.00715.67
7.1.70.0040.00816.51
7.1.60.0050.01016.50
7.1.50.0070.00715.88
7.1.40.0070.01015.80
7.1.30.0090.00315.73
7.1.20.0040.01215.97
7.1.10.0030.00715.75
7.1.00.0020.04619.09
7.0.330.0040.01115.42
7.0.320.0070.00715.52
7.0.310.0070.00715.49
7.0.300.0030.00915.50
7.0.290.0030.01015.59
7.0.280.0030.00915.23
7.0.270.0090.00615.42
7.0.260.0060.00615.50
7.0.250.0070.00315.43
7.0.240.0060.01015.54
7.0.230.0000.01715.50
7.0.220.0000.01615.59
7.0.210.0080.00615.31
7.0.200.0210.00714.92
7.0.190.0060.00615.34
7.0.180.0100.00715.19
7.0.170.0100.00615.58
7.0.160.0030.00915.26
7.0.150.0040.00415.36
7.0.140.0030.01015.61
7.0.130.0050.04018.78
7.0.120.0120.03018.82
7.0.110.0070.03518.71
7.0.100.0080.03518.73
7.0.90.0100.03018.81
7.0.80.0120.02718.74
7.0.70.0120.02818.81
7.0.60.0060.03118.47
7.0.50.0070.03818.84
7.0.40.0130.03817.79
7.0.30.0050.03217.77
7.0.20.0100.03017.88
7.0.10.0080.04317.64
7.0.00.0050.03517.76
5.6.400.0000.01314.43
5.6.390.0070.00414.09
5.6.380.0000.00814.69
5.6.370.0060.00614.04
5.6.360.0160.00314.23
5.6.350.0040.00714.38
5.6.340.0040.00414.21
5.6.330.0090.00614.53
5.6.320.0030.00714.62
5.6.310.0090.00614.66
5.6.300.0100.00314.43
5.6.290.0030.01314.66
5.6.280.0100.03517.76
5.6.270.0100.02817.84
5.6.260.0070.03717.87
5.6.250.0070.04517.88
5.6.240.0080.03017.80
5.6.230.0110.03017.58
5.6.220.0120.02617.82
5.6.210.0080.02617.71
5.6.200.0060.03317.76
5.6.190.0090.04417.69
5.6.180.0070.04517.77
5.6.170.0060.04317.79
5.6.160.0070.04417.62
5.6.150.0070.03817.50
5.6.140.0030.03817.69
5.6.130.0050.03317.67
5.6.120.0040.03317.78
5.6.110.0100.04817.82
5.6.100.0080.03217.73
5.6.90.0030.04917.68
5.6.80.0050.03417.26
5.6.70.0050.03217.37
5.6.60.0100.02817.28
5.6.50.0050.03217.47
5.6.40.0130.02717.43
5.6.30.0060.04317.34
5.6.20.0120.02717.37
5.6.10.0100.02717.49
5.6.00.0020.03617.23

preferences:
67.85 ms | 401 KiB | 5 Q