3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Hello World";$spaceCount = substr_count($str, " "); $letterIndx = 0; // count number of spaces and then loop for($i=0; $i<=$spaceCount; $i++) { // get space positions $spaceIndx = strpos($str, " ", $letterIndx); // assign word by specifying start position and length if ($spaceIndx == 0) { $word = substr($str, $letterIndx); } else { $word = substr($str, $letterIndx, $spaceIndx - $letterIndx); } // push word into array $myArray[] = $word; // get first letter after space $letterIndx = $spaceIndx + 1; } // reverse the array $reverse = array_reverse($myArray); // echo it out foreach($reverse as $rev) { echo $rev." "; } ?>

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.00716.49
8.3.50.0100.00922.86
8.3.40.0170.00018.85
8.3.30.0100.00319.09
8.3.20.0070.00020.35
8.3.10.0040.00423.66
8.3.00.0040.00417.63
8.2.180.0080.00816.88
8.2.170.0070.01122.96
8.2.160.0060.00920.57
8.2.150.0000.00824.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00317.88
8.2.110.0110.01122.10
8.2.100.0170.00419.29
8.2.90.0080.00019.31
8.2.80.0000.00917.97
8.2.70.0000.00817.75
8.2.60.0090.00018.05
8.2.50.0030.00518.07
8.2.40.0040.00418.28
8.2.30.0040.00418.18
8.2.20.0070.00017.91
8.2.10.0070.00018.03
8.2.00.0000.00817.82
8.1.280.0140.00025.92
8.1.270.0060.00323.97
8.1.260.0030.01026.35
8.1.250.0020.00528.09
8.1.240.0090.00023.69
8.1.230.0000.01219.10
8.1.220.0030.00517.78
8.1.210.0040.00418.77
8.1.200.0100.00017.35
8.1.190.0040.00417.23
8.1.180.0050.00318.10
8.1.170.0030.00518.56
8.1.160.0050.00322.00
8.1.150.0040.00418.82
8.1.140.0040.00417.40
8.1.130.0070.00017.91
8.1.120.0070.00017.58
8.1.110.0080.00017.49
8.1.100.0000.00717.45
8.1.90.0030.00317.51
8.1.80.0070.00017.49
8.1.70.0000.00717.43
8.1.60.0080.00017.59
8.1.50.0000.00717.58
8.1.40.0060.00317.41
8.1.30.0000.00817.53
8.1.20.0040.00417.66
8.1.10.0000.00717.53
8.1.00.0040.00417.50
8.0.300.0050.00218.77
8.0.290.0000.00716.88
8.0.280.0040.00418.47
8.0.270.0070.00317.30
8.0.260.0000.00617.28
8.0.250.0030.00317.03
8.0.240.0060.00317.07
8.0.230.0000.00717.03
8.0.220.0030.00317.04
8.0.210.0070.00017.03
8.0.200.0000.00617.06
8.0.190.0040.00416.93
8.0.180.0040.00417.04
8.0.170.0000.00816.95
8.0.160.0000.00717.04
8.0.150.0040.00416.83
8.0.140.0000.00716.97
8.0.130.0070.00013.43
8.0.120.0040.00416.98
8.0.110.0070.00017.00
8.0.100.0040.00416.98
8.0.90.0000.00717.04
8.0.80.0040.01116.98
8.0.70.0000.00817.02
8.0.60.0040.00416.93
8.0.50.0000.00716.98
8.0.30.0120.00817.14
8.0.20.0100.00917.40
8.0.10.0030.00516.89
8.0.00.0100.01016.87
7.4.330.0060.00015.07
7.4.320.0000.00616.54
7.4.300.0060.00016.52
7.4.290.0000.00716.63
7.4.280.0070.00316.57
7.4.270.0070.00016.52
7.4.260.0070.00016.49
7.4.250.0050.00216.52
7.4.240.0040.00316.52
7.4.230.0000.00716.34
7.4.220.0100.00716.51
7.4.210.0030.01616.45
7.4.200.0040.00416.36
7.4.160.0060.00916.50
7.4.150.0060.01317.40
7.4.140.0080.01017.86
7.4.130.0090.01116.61
7.4.120.0130.00616.59
7.4.110.0080.00816.57
7.4.100.0150.00316.58
7.4.90.0060.01216.51
7.4.80.0110.01219.39
7.4.70.0120.00416.40
7.4.60.0190.00316.39
7.4.50.0000.01016.43
7.4.40.0100.00716.65
7.4.30.0150.00416.35
7.4.00.0110.00715.01
7.3.330.0030.00313.10
7.3.320.0000.00613.06
7.3.310.0070.00016.11
7.3.300.0040.00416.05
7.3.290.0030.01016.29
7.3.280.0080.00916.30
7.3.270.0090.00917.40
7.3.260.0080.01116.25
7.3.250.0150.00516.53
7.3.240.0070.01016.62
7.3.230.0000.01616.39
7.3.210.0070.00816.49
7.3.200.0090.01319.39
7.3.190.0090.01216.26
7.3.180.0130.00316.32
7.3.170.0120.00316.38
7.3.160.0090.00616.22
7.2.330.0120.00916.82
7.2.320.0070.01216.77
7.2.310.0070.01016.73
7.2.300.0120.00616.62
7.2.290.0170.00016.79
7.2.60.0080.00816.54
7.2.00.0150.00319.34
7.1.200.0040.00415.88
7.1.100.0040.00718.09
7.1.70.0000.01017.13
7.1.60.0130.01319.40
7.1.50.0070.01116.99
7.1.00.0070.07322.36
7.0.200.0000.00816.97
7.0.140.0100.07021.99
7.0.60.0100.04019.81
7.0.50.0230.06717.83
7.0.40.0070.06720.27
7.0.30.0330.06020.09
7.0.20.0230.04020.02
7.0.10.0100.07320.18
7.0.00.0070.04020.03
5.6.280.0070.07021.15
5.6.210.0030.06720.61
5.6.200.0100.05718.13
5.6.190.0070.09320.77
5.6.180.0230.04020.60
5.6.170.0370.06720.42
5.6.160.0130.03720.71
5.6.150.0100.07018.12
5.6.140.0070.06718.18
5.6.130.0200.07318.18
5.6.120.0100.08021.04
5.6.110.0070.08720.98
5.6.100.0000.04321.11
5.6.90.0030.04021.00
5.6.80.0070.08720.37
5.5.350.0030.06720.44
5.5.340.0070.03318.01
5.5.330.0130.07020.19
5.5.320.0330.05020.13
5.5.310.0270.06720.41
5.5.300.0070.03717.91
5.5.290.0070.08017.98
5.5.280.0070.04320.68
5.5.270.0070.07020.95
5.5.260.0030.06320.74
5.5.250.0070.08720.54
5.5.240.0330.06020.03
5.4.450.0130.04319.46
5.4.440.0600.04719.57
5.4.430.0430.04319.54
5.4.420.0400.04319.25
5.4.410.0270.04019.08
5.4.400.0400.04319.09
5.4.390.0130.04719.13
5.4.380.0930.07318.56
5.4.370.0600.06718.70
5.4.360.1070.05018.66
5.4.350.0870.06318.59
5.4.340.0900.06018.57
5.4.320.0070.04112.45
5.4.310.0050.04012.45
5.4.300.0080.03612.46
5.4.290.0050.04212.45
5.4.280.0090.04112.35
5.4.270.0090.05012.35
5.4.260.0050.04912.35
5.4.250.0100.03512.35
5.4.240.0050.04912.35
5.4.230.0080.04012.34
5.4.220.0100.03612.34
5.4.210.0080.03712.34
5.4.200.0060.04112.34
5.4.190.0060.03912.34
5.4.180.0060.03612.34
5.4.170.0070.04212.35
5.4.160.0060.03712.35
5.4.150.0050.03612.34
5.4.140.0090.03412.02
5.4.130.0040.03712.01
5.4.120.0040.03711.97
5.4.110.0050.04011.96
5.4.100.0080.03211.97
5.4.90.0090.03611.97
5.4.80.0080.03611.96
5.4.70.0050.03411.96
5.4.60.0080.03911.96
5.4.50.0100.03711.96
5.4.40.0070.03711.95
5.4.30.0070.03911.95
5.4.20.0110.03411.95
5.4.10.0070.04511.95
5.4.00.0030.03911.44
5.3.290.0050.04612.80
5.3.280.0070.04812.71
5.3.270.0070.04512.72
5.3.260.0080.03912.72
5.3.250.0100.05112.72
5.3.240.0110.03712.72
5.3.230.0080.03812.71
5.3.220.0040.04112.68
5.3.210.0050.03912.68
5.3.200.0110.04712.68
5.3.190.0030.04012.67
5.3.180.0050.04812.68
5.3.170.0040.03812.67
5.3.160.0070.04112.67
5.3.150.0090.04012.67
5.3.140.0080.03812.66
5.3.130.0100.04012.66
5.3.120.0090.04412.65
5.3.110.0070.04212.66
5.3.100.0090.04912.12
5.3.90.0080.03712.08
5.3.80.0090.03912.07
5.3.70.0080.04012.08
5.3.60.0050.04612.06
5.3.50.0070.03512.00
5.3.40.0050.03712.00
5.3.30.0070.03411.95
5.3.20.0040.04111.72
5.3.10.0070.03911.69
5.3.00.0050.03711.68
5.2.170.0060.0299.18
5.2.160.0070.0389.18
5.2.150.0080.0329.18
5.2.140.0060.0339.18
5.2.130.0040.0409.14
5.2.120.0060.0319.14
5.2.110.0030.0309.14
5.2.100.0060.0279.13
5.2.90.0060.0369.13
5.2.80.0070.0379.13
5.2.70.0050.0399.14
5.2.60.0060.0379.09
5.2.50.0090.0299.06
5.2.40.0060.0289.04
5.2.30.0050.0299.01
5.2.20.0070.0319.00
5.2.10.0060.0308.92
5.2.00.0030.0378.78
5.1.60.0060.0278.07
5.1.50.0040.0288.06
5.1.40.0050.0258.04
5.1.30.0040.0318.39
5.1.20.0090.0258.41
5.1.10.0060.0258.13
5.1.00.0060.0268.14
5.0.50.0060.0206.63
5.0.40.0040.0246.49
5.0.30.0070.0356.30
5.0.20.0020.0236.27
5.0.10.0050.0306.25
5.0.00.0030.0366.24
4.4.90.0020.0254.78
4.4.80.0070.0184.76
4.4.70.0050.0214.76
4.4.60.0030.0174.76
4.4.50.0020.0164.77
4.4.40.0040.0404.71
4.4.30.0030.0174.76
4.4.20.0050.0164.85
4.4.10.0060.0214.85
4.4.00.0050.0224.75
4.3.110.0010.0174.67
4.3.100.0040.0174.67
4.3.90.0020.0144.64
4.3.80.0040.0354.58
4.3.70.0020.0174.63
4.3.60.0040.0224.63
4.3.50.0060.0154.63
4.3.40.0050.0244.54
4.3.30.0030.0153.30
4.3.20.0010.0193.27
4.3.10.0050.0173.23
4.3.00.0030.01315.97

preferences:
42.4 ms | 401 KiB | 5 Q