3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_between($the_string, $starts_with, $ends_with) { $temp = explode($starts_with, $the_string); $result_array = array(); $inc = 0; foreach($temp as $a_start_match) { //echo $inc; if (strlen($ends_with) <= strlen($a_start_match)) { echo "testing ".substr($a_start_match, -strlen($ends_with))." against ".$ends_with."\n"; if(substr($a_start_match, -strlen($ends_with)) === $ends_with) { $result_array[$inc]=$a_start_match; $inc++; } } } return $result_array; } $the_string = "some string here string_1---1-----string2 some string here string_1----2----string2 some string here string_1----3----string2"; $a = "string_1"; $b = "string2"; print_R (get_between($the_string,$a,$b));

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.0040.01018.15
8.3.50.0100.00921.99
8.3.40.0040.01818.84
8.3.30.0070.00718.68
8.3.20.0090.00618.78
8.3.10.0080.00021.21
8.3.00.0050.00321.94
8.2.180.0100.00716.50
8.2.170.0160.00022.96
8.2.160.0030.01022.05
8.2.150.0090.00024.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0000.00720.99
8.2.110.0090.00020.56
8.2.100.0040.00717.97
8.2.90.0040.00419.35
8.2.80.0000.00917.97
8.2.70.0000.00817.48
8.2.60.0040.00417.93
8.2.50.0060.00318.07
8.2.40.0040.00418.28
8.2.30.0000.00721.28
8.2.20.0060.00317.79
8.2.10.0040.00417.64
8.2.00.0030.00617.78
8.1.270.0030.00523.99
8.1.260.0150.00026.35
8.1.250.0070.00028.09
8.1.240.0070.00322.46
8.1.230.0040.00720.95
8.1.220.0080.00018.77
8.1.210.0000.00818.85
8.1.200.0070.00317.35
8.1.190.0050.00317.53
8.1.180.0080.00018.10
8.1.170.0000.00918.59
8.1.160.0110.00018.77
8.1.150.0000.00818.65
8.1.140.0000.00717.46
8.1.130.0070.00017.84
8.1.120.0000.00717.39
8.1.110.0080.00017.34
8.1.100.0030.00317.52
8.1.90.0000.00717.51
8.1.80.0030.00617.48
8.1.70.0030.00517.35
8.1.60.0030.00617.49
8.1.50.0070.00017.50
8.1.40.0000.00717.54
8.1.30.0080.00017.55
8.1.20.0000.00817.73
8.1.10.0070.00017.55
8.1.00.0000.00717.52
8.0.300.0040.00420.04
8.0.290.0040.00417.18
8.0.280.0080.00018.46
8.0.270.0070.00017.15
8.0.260.0000.00716.89
8.0.250.0000.00716.92
8.0.240.0060.00317.01
8.0.230.0000.00716.93
8.0.220.0040.00416.87
8.0.210.0030.00316.93
8.0.200.0000.00716.97
8.0.190.0050.00216.88
8.0.180.0000.00716.83
8.0.170.0030.00616.99
8.0.160.0000.00716.91
8.0.150.0000.00716.91
8.0.140.0000.00716.89
8.0.130.0030.00313.33
8.0.120.0040.00416.83
8.0.110.0000.00816.97
8.0.100.0040.00416.76
8.0.90.0040.00416.92
8.0.80.0150.00416.93
8.0.70.0070.00016.84
8.0.60.0070.00016.93
8.0.50.0000.00716.84
8.0.30.0120.00617.01
8.0.20.0110.00717.40
8.0.10.0050.00216.91
8.0.00.0090.00816.91
7.4.330.0000.00616.81
7.4.320.0000.00716.63
7.4.300.0000.00716.64
7.4.290.0030.00316.54
7.4.280.0000.00716.64
7.4.270.0030.00316.64
7.4.260.0050.00013.23
7.4.250.0000.00716.49
7.4.240.0070.00016.55
7.4.230.0050.00316.54
7.4.220.0090.00916.60
7.4.210.0080.00616.62
7.4.200.0040.00416.70
7.4.190.0030.00316.59
7.4.160.0140.00716.51
7.4.150.0100.00717.40
7.4.140.0150.00317.86
7.4.130.0090.00816.52
7.4.120.0140.00616.55
7.4.110.0090.00816.48
7.4.100.0190.00716.47
7.4.90.0120.00616.50
7.4.80.0090.00919.39
7.4.70.0070.01016.55
7.4.60.0130.00516.70
7.4.50.0060.00316.30
7.4.40.0090.00622.77
7.4.30.0180.00316.57
7.4.00.0030.01214.93
7.3.330.0060.00013.37
7.3.320.0030.00313.41
7.3.310.0030.00316.28
7.3.300.0000.00616.41
7.3.290.0000.01416.30
7.3.280.0110.00516.38
7.3.270.0120.00517.40
7.3.260.0070.01418.24
7.3.250.0110.01016.57
7.3.240.0140.00716.72
7.3.230.0040.01316.39
7.3.210.0100.00616.46
7.3.200.0060.01319.39
7.3.190.0100.00716.31
7.3.180.0050.01116.43
7.3.170.0110.01116.48
7.3.160.0110.00616.57
7.3.120.0000.01415.00
7.3.10.0200.00016.68
7.3.00.0100.01016.75
7.2.330.0130.00716.41
7.2.320.0060.01216.76
7.2.310.0130.01016.45
7.2.300.0110.00816.75
7.2.290.0110.00716.80
7.2.130.0030.01416.80
7.2.120.0110.00417.03
7.2.110.0070.01016.99
7.2.100.0100.01016.86
7.2.90.0090.00616.96
7.2.80.0120.00616.66
7.2.70.0160.00016.73
7.2.60.0130.00316.98
7.2.50.0100.00717.03
7.2.40.0080.00816.96
7.2.30.0030.01216.95
7.2.20.0060.00616.51
7.2.10.0120.00316.76
7.2.00.0110.00316.64
7.1.250.0130.00615.83
7.1.240.0160.00315.86
7.1.230.0040.01115.62
7.1.220.0060.00915.89
7.1.210.0040.01115.74
7.1.200.0070.00815.88
7.1.190.0100.00715.98
7.1.180.0100.00315.85
7.1.170.0000.01315.55
7.1.160.0040.01215.79
7.1.150.0130.00315.76
7.1.140.0030.00915.57
7.1.130.0070.00415.51
7.1.120.0120.00315.80
7.1.110.0060.00615.81
7.1.100.0030.01015.86
7.1.90.0080.00815.64
7.1.80.0100.00615.95
7.1.70.0050.00716.56
7.1.60.0020.01016.43
7.1.50.0090.00416.17
7.1.40.0090.00616.03
7.1.30.0060.00616.19
7.1.20.0020.01016.31
7.1.10.0020.00816.22
7.1.00.0050.00816.34
7.0.330.0120.00315.37
7.0.320.0030.01015.34
7.0.310.0110.00715.38
7.0.300.0030.01315.52
7.0.290.0120.00315.34
7.0.280.0030.00915.27
7.0.270.0060.00315.22
7.0.260.0070.00715.39
7.0.250.0060.00615.48
7.0.240.0000.01315.42
7.0.230.0060.00615.29
7.0.220.0060.00615.45
7.0.210.0090.00315.53
7.0.200.0010.00815.98
7.0.190.0080.00615.93
7.0.180.0060.00815.96
7.0.170.0030.00815.78
7.0.160.0060.00415.97
7.0.150.0040.00715.78
7.0.140.0030.00515.94
7.0.130.0040.00716.04
7.0.120.0040.00616.11
7.0.110.0070.00315.75
7.0.100.0040.00815.73
7.0.90.0070.00815.67
7.0.80.0060.00715.83
7.0.70.0090.00416.00
7.0.60.0050.00715.86
7.0.50.0060.00615.91
7.0.40.0060.00514.05
7.0.30.0020.00514.04
7.0.20.0050.00614.01
7.0.10.0040.00813.96
7.0.00.0030.00814.04
5.6.380.0030.01014.64
5.6.370.0050.00814.10
5.6.360.0030.00614.19
5.6.350.0060.00614.65
5.6.340.0030.01014.54
5.6.330.0050.00514.48
5.6.320.0050.00814.33
5.6.310.0100.00314.45
5.6.300.0050.02217.69
5.6.290.0030.03117.60
5.6.280.0070.02517.74
5.6.270.0050.02217.76
5.6.260.0070.02217.70
5.6.250.0080.02517.62
5.6.240.0050.02517.67
5.6.230.0060.03017.45
5.6.220.0050.02517.66
5.6.210.0050.02517.72
5.6.200.0070.02317.79
5.6.190.0050.02217.72
5.6.180.0030.02517.51
5.6.170.0100.02117.54
5.6.160.0050.03017.67
5.6.150.0020.03217.54
5.6.140.0100.02717.60
5.6.130.0100.02017.74
5.6.120.0050.02317.72
5.6.110.0090.02617.65
5.6.100.0060.02417.56
5.6.90.0080.02317.44
5.6.80.0050.02517.22
5.6.70.0040.02317.40
5.6.60.0030.03017.31
5.6.50.0020.02917.26
5.6.40.0000.02917.28
5.6.30.0030.03017.29
5.6.20.0090.02217.18
5.6.10.0120.01617.33
5.6.00.0160.02217.27
5.5.380.0010.02514.41
5.5.370.0070.02114.38
5.5.360.0050.02214.58
5.5.350.0060.02114.53
5.5.340.0070.02214.73
5.5.330.0030.02314.75
5.5.320.0080.03414.67
5.5.310.0030.02414.71
5.5.300.0100.01914.83
5.5.290.0020.02914.79
5.5.280.0020.02614.51
5.5.270.0000.02914.70
5.5.260.0050.02214.69
5.5.250.0050.02314.52
5.5.240.0050.02214.14
5.5.230.0070.02014.38
5.5.220.0080.03014.23
5.5.210.0030.02714.28
5.5.200.0100.01714.07
5.5.190.0060.02214.27
5.5.180.0050.02414.35
5.5.170.0000.01111.06
5.5.160.0030.02314.25
5.5.150.0050.02114.25
5.5.140.0030.02414.07
5.5.130.0020.02614.18
5.5.120.0040.02314.29
5.5.110.0120.02114.41
5.5.100.0050.02414.18
5.5.90.0030.02714.30
5.5.80.0050.02214.29
5.5.70.0020.02414.10
5.5.60.0050.01914.31
5.5.50.0050.04314.36
5.5.40.0060.02414.18
5.5.30.0020.02714.09
5.5.20.0050.02414.28
5.5.10.0030.03014.18
5.5.00.0000.02814.06
5.4.450.0020.03115.22
5.4.440.0030.02415.22
5.4.430.0150.02115.21
5.4.420.0100.02015.28
5.4.410.0080.02015.06
5.4.400.0020.02915.14
5.4.390.0030.02214.95
5.4.380.0020.02714.94
5.4.370.0080.02315.07
5.4.360.0060.02515.03
5.4.350.0060.02015.15
5.4.340.0040.02715.07
5.4.330.0100.00711.27
5.4.320.0080.02415.15
5.4.310.0050.02615.18
5.4.300.0130.02015.27
5.4.290.0070.02415.30
5.4.280.0050.02815.13
5.4.270.0060.02415.03
5.4.260.0100.02515.10
5.4.250.0040.02415.20
5.4.240.0080.02114.95
5.4.230.0070.02114.98
5.4.220.0050.02414.89
5.4.210.0050.02515.11
5.4.200.0030.02715.08
5.4.190.0000.02715.06
5.4.180.0130.01615.24
5.4.170.0070.02015.08
5.4.160.0030.02415.01
5.4.150.0060.02115.17
5.4.140.0040.02213.90
5.4.130.0050.02313.81
5.4.120.0060.02013.87
5.4.110.0020.04613.86
5.4.100.0050.02013.69
5.4.90.0000.02613.89
5.4.80.0070.01913.86
5.4.70.0060.02014.00
5.4.60.0060.02614.01
5.4.50.0050.02713.98
5.4.40.0070.02113.87
5.4.30.0050.02313.69
5.4.20.0110.01914.00
5.4.10.0060.02113.93
5.4.00.0100.01913.66
5.3.290.0090.02312.72
5.3.280.0080.02212.75
5.3.270.0060.02412.78
5.3.260.0090.02112.62
5.3.250.0120.01812.63
5.3.240.0080.01912.72
5.3.230.0060.02912.74
5.3.220.0060.02612.57
5.3.210.0070.02212.71
5.3.200.0100.02112.54
5.3.190.0040.02512.56
5.3.180.0100.02112.65
5.3.170.0100.02312.80
5.3.160.0100.01812.72
5.3.150.0140.01912.82
5.3.140.0050.02512.63
5.3.130.0120.01812.75
5.3.120.0080.02612.68
5.3.110.0070.02412.51
5.3.100.0070.02412.41
5.3.90.0050.02412.53
5.3.80.0070.02312.38
5.3.70.0100.02212.41
5.3.60.0100.02112.37
5.3.50.0070.02312.34
5.3.40.0040.02612.17
5.3.30.0050.02512.36
5.3.20.0020.02512.26
5.3.10.0050.02112.10
5.3.00.0090.01912.24

preferences:
59.23 ms | 400 KiB | 5 Q