3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "PHP CODING TECH"; $counters = array_fill_keys(explode(' ', $input), 1); // ['PHP' => 1, 'CODING' => 1, 'TECH' => 1] $bump = false; // permit outer loop to run while (!$bump) { // while still letters to output.... $bump = true; // stop after this iteration unless more letters to output foreach ($counters as $word => &$len) { // $len is mod-by-ref for incrementing echo substr($word, 0, $len); // echo letters using $len if ($bump && isset($word[$len])) { // if no $len has been incremented during inner loop... ++$len; // increment this word's $len $bump = false; // permit outer loop to run again } } echo "\n"; // separate outputs }

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.5.10.0200.00616.76
8.5.00.0210.00819.88
8.4.150.0030.00014.05
8.4.140.0150.00617.64
8.4.130.0100.01017.77
8.4.120.0090.01120.57
8.4.110.0140.00620.45
8.4.100.0100.01117.71
8.4.90.0110.00820.54
8.4.80.0100.00824.37
8.4.70.0120.00817.86
8.4.60.0140.00618.62
8.4.50.0120.00818.83
8.4.40.0070.00417.57
8.4.30.0080.01217.59
8.4.20.0040.01219.23
8.4.10.0090.00317.59
8.3.280.0110.01118.43
8.3.270.0140.00516.48
8.3.260.0060.00516.71
8.3.250.0080.01018.79
8.3.240.0070.01217.17
8.3.230.0050.00416.54
8.3.220.0050.00318.90
8.3.210.0020.00518.43
8.3.200.0060.00316.67
8.3.190.0080.00717.11
8.3.180.0140.00616.55
8.3.170.0040.00417.27
8.3.160.0030.00518.63
8.3.150.0080.00020.70
8.3.140.0040.01416.44
8.3.130.0070.00316.72
8.3.120.0080.00820.80
8.3.110.0030.00620.94
8.3.100.0070.01424.06
8.3.90.0070.01026.77
8.3.80.0060.00318.30
8.3.70.0130.00618.68
8.3.60.0090.00918.31
8.3.50.0090.00816.50
8.3.40.0090.00918.85
8.3.30.0070.00718.70
8.3.20.0040.00421.80
8.3.10.0070.00021.66
8.3.00.0050.00221.95
8.2.290.0060.00317.16
8.2.280.0040.00518.38
8.2.270.0100.01017.17
8.2.260.0090.00916.71
8.2.250.0080.00016.55
8.2.240.0000.00917.15
8.2.230.0040.00422.58
8.2.220.0100.01037.54
8.2.210.0110.00426.77
8.2.200.0000.00916.63
8.2.190.0110.00616.75
8.2.180.0070.01118.41
8.2.170.0140.00022.96
8.2.160.0040.01120.43
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0040.00419.09
8.2.120.0040.00426.35
8.2.110.0030.00722.16
8.2.100.0120.00017.97
8.2.90.0050.00319.95
8.2.80.0030.00518.05
8.2.70.0000.00818.04
8.2.60.0030.00518.09
8.2.50.0080.00018.16
8.2.40.0000.00820.58
8.2.30.0040.00419.44
8.2.20.0040.00417.98
8.2.10.0000.00718.11
8.2.00.0040.00418.06
8.1.330.0150.00416.22
8.1.320.0100.00916.19
8.1.310.0090.00616.48
8.1.300.0030.00618.47
8.1.290.0090.00030.84
8.1.280.0150.00325.92
8.1.270.0080.00023.66
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0080.00023.96
8.1.230.0090.00319.15
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0050.00517.35
8.1.190.0060.00317.23
8.1.180.0030.00518.10
8.1.170.0050.00318.94
8.1.160.0000.00818.88
8.1.150.0030.00319.00
8.1.140.0040.00417.64
8.1.130.0030.00318.89
8.1.120.0000.00717.36
8.1.110.0040.00417.52
8.1.100.0030.00517.46
8.1.90.0000.00717.34
8.1.80.0000.00717.49
8.1.70.0070.00017.49
8.1.60.0030.00617.59
8.1.50.0040.00417.52
8.1.40.0070.00017.56
8.1.30.0050.00317.55
8.1.20.0060.00317.55
8.1.10.0050.00517.58
8.1.00.0030.00617.52
8.0.300.0040.00419.68
8.0.290.0030.00616.75
8.0.280.0040.00418.49
8.0.270.0070.00317.25
8.0.260.0000.00718.96
8.0.250.0000.00716.83
8.0.240.0000.00716.86
8.0.230.0000.00716.92
8.0.220.0000.01016.92
8.0.210.0070.00016.89
8.0.200.0000.00816.94
8.0.190.0040.00416.95
8.0.180.0000.00716.83
8.0.170.0060.00316.92
8.0.160.0040.00416.87
8.0.150.0070.00016.89
8.0.140.0040.00316.82
8.0.130.0000.00813.29
8.0.120.0000.00716.82
8.0.110.0000.00716.71
8.0.100.0000.00816.78
8.0.90.0000.00816.95
8.0.80.0120.00616.90
8.0.70.0040.00416.91
8.0.60.0000.00716.79
8.0.50.0000.00817.00
8.0.30.0090.01117.03
8.0.20.0080.01117.40
8.0.10.0000.00716.88
8.0.00.0110.00916.74
7.4.330.0030.00315.55
7.4.320.0060.00016.48
7.4.300.0070.00016.61
7.4.290.0030.00316.46
7.4.280.0060.00316.61
7.4.270.0000.00716.61
7.4.260.0000.00816.57
7.4.250.0030.00316.36
7.4.240.0030.00316.62
7.4.230.0000.00716.60
7.4.220.0030.00416.67
7.4.210.0130.00416.37
7.4.200.0000.00716.39
7.4.160.0060.01316.39
7.4.140.0120.00917.86
7.4.130.0120.00416.45
7.4.120.0080.01016.52
7.4.110.0060.01116.48
7.4.100.0140.00716.41
7.4.90.0070.01016.46
7.4.80.0170.00319.39
7.4.70.0120.00616.57
7.4.60.0060.00916.43
7.4.50.0040.00916.31
7.4.40.0040.01516.51
7.4.00.0070.00715.02
7.3.330.0050.00013.13
7.3.320.0030.00313.16
7.3.310.0030.00316.42
7.3.300.0040.00416.24
7.3.290.0070.00016.36
7.3.280.0080.00816.29
7.3.260.0100.00816.47
7.3.240.0120.00616.44
7.3.230.0070.01016.64
7.3.210.0090.00616.66
7.3.200.0060.01616.49
7.3.190.0090.00916.57
7.3.180.0090.00616.27
7.3.170.0130.00516.38
7.3.160.0150.00016.49
7.3.100.0110.00314.73
7.3.90.0030.01014.60
7.3.80.0000.01314.98
7.3.70.0100.00514.91
7.3.60.0080.00814.86
7.3.50.0030.01114.82
7.3.40.0090.00414.75
7.3.30.0090.00914.88
7.3.20.0060.00914.99
7.3.10.0110.00314.72
7.3.00.0110.00614.59
7.2.330.0140.00916.56
7.2.320.0000.02016.78
7.2.310.0110.00816.44
7.2.300.0120.00416.71
7.2.290.0060.01216.70
7.2.230.0030.01115.20
7.2.220.0030.01015.25
7.2.210.0000.01814.95
7.2.200.0030.01215.08
7.2.190.0080.00714.75
7.2.180.0030.01214.91
7.2.170.0050.01014.92
7.2.160.0120.00615.07
7.2.150.0090.00615.02
7.2.140.0030.01215.07
7.2.130.0120.00614.95
7.2.120.0040.01315.16
7.2.110.0090.00614.80
7.2.100.0120.00315.10
7.2.90.0120.00815.05
7.2.80.0110.00915.07
7.2.70.0080.00915.31
7.2.60.0080.00516.05
7.2.50.0080.00715.89
7.2.40.0960.00516.47
7.2.30.0760.00816.34
7.2.20.0890.00916.52
7.2.10.1060.00816.47
7.2.00.0570.00616.59
7.1.320.0070.00714.04
7.1.310.0120.00313.92
7.1.300.0120.00914.11
7.1.290.0070.00713.89
7.1.280.0130.00014.11
7.1.270.0050.00914.07
7.1.260.0000.01413.89
7.1.250.0030.01514.16
7.1.240.0060.01313.55
7.1.230.0060.01313.98
7.1.220.0070.01114.05
7.1.210.0160.00613.38
7.1.200.0110.00515.01
7.1.190.0120.00513.75
7.1.180.0100.00513.88
7.1.170.0110.00613.65
7.1.160.0690.01115.33
7.1.150.0660.00715.32
7.1.140.0830.00915.32
7.1.130.0850.01315.44
7.1.120.0620.01015.40
7.1.110.0520.00914.92
7.1.100.0760.01014.82
7.1.90.1030.00815.13
7.1.80.0700.01014.98
7.1.70.0860.01314.46
7.1.60.0820.00923.41
7.1.50.0220.01323.32
7.1.40.0220.01123.01
7.1.30.0260.01423.25
7.1.20.0250.01023.24
7.1.10.0720.00914.33
7.1.00.0720.01014.50
7.0.330.0160.01313.63
5.6.400.0110.00813.83
5.6.390.0110.01114.30
5.6.380.0130.00413.78

preferences:
40.76 ms | 403 KiB | 5 Q