3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_between($the_string, $starts_with, $ends_with) { $the_string = substr($the_string,strpos ($the_string , $starts_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.0110.00418.30
8.3.50.0250.00321.27
8.3.40.0110.00318.97
8.3.30.0100.01018.57
8.3.20.0040.01118.47
8.3.10.0040.00421.09
8.3.00.0090.00023.49
8.2.180.0040.01116.63
8.2.170.0100.01022.96
8.2.160.0070.00720.39
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0070.00026.16
8.2.120.0040.00419.79
8.2.110.0090.00020.25
8.2.100.0070.00417.97
8.2.90.0050.00317.78
8.2.80.0000.00817.97
8.2.70.0000.00817.50
8.2.60.0070.00418.05
8.2.50.0000.00918.07
8.2.40.0040.00418.16
8.2.30.0040.00421.09
8.2.20.0070.00017.65
8.2.10.0000.00717.73
8.2.00.0080.00017.73
8.1.280.0150.00325.92
8.1.270.0070.00023.99
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00322.07
8.1.230.0070.00320.94
8.1.220.0030.00517.78
8.1.210.0040.00418.89
8.1.200.0060.00317.35
8.1.190.0000.00717.51
8.1.180.0040.00418.10
8.1.170.0000.00818.57
8.1.160.0000.00718.84
8.1.150.0020.00518.65
8.1.140.0070.00017.42
8.1.130.0040.00417.82
8.1.120.0040.00417.54
8.1.110.0000.00717.30
8.1.100.0020.00517.45
8.1.90.0000.00717.44
8.1.80.0000.00717.48
8.1.70.0000.00717.39
8.1.60.0030.00617.55
8.1.50.0040.00417.36
8.1.40.0090.00017.50
8.1.30.0030.00617.66
8.1.20.0040.00417.52
8.1.10.0030.00617.47
8.1.00.0030.00617.44
8.0.300.0040.00420.03
8.0.290.0000.00717.16
8.0.280.0000.00718.51
8.0.270.0070.00017.27
8.0.260.0000.00616.82
8.0.250.0060.00316.91
8.0.240.0040.00416.96
8.0.230.0000.00716.93
8.0.220.0070.00316.84
8.0.210.0070.00016.80
8.0.200.0060.00016.84
8.0.190.0030.00517.00
8.0.180.0040.00416.98
8.0.170.0000.00816.94
8.0.160.0000.00716.94
8.0.150.0070.00016.83
8.0.140.0000.00816.89
8.0.130.0000.00513.30
8.0.120.0040.00416.88
8.0.110.0030.00516.75
8.0.100.0040.00416.79
8.0.90.0000.00816.88
8.0.80.0110.00416.89
8.0.70.0000.00817.01
8.0.60.0050.00216.75
8.0.50.0040.00416.86
8.0.30.0100.00917.06
8.0.20.0100.00917.40
8.0.10.0040.00416.96
8.0.00.0120.00716.80
7.4.330.0020.00214.83
7.4.320.0060.00016.61
7.4.300.0000.00716.48
7.4.290.0070.00016.52
7.4.280.0060.00316.55
7.4.270.0000.00716.62
7.4.260.0060.00013.27
7.4.250.0040.00416.47
7.4.240.0080.00016.45
7.4.230.0020.00516.63
7.4.220.0030.01816.56
7.4.210.0050.01016.58
7.4.200.0000.00716.41
7.4.190.0040.00416.48
7.4.160.0130.00316.58
7.4.150.0090.00817.40
7.4.140.0150.00417.86
7.4.130.0100.00916.54
7.4.120.0090.01016.40
7.4.110.0030.01316.61
7.4.100.0100.01016.47
7.4.90.0130.01016.72
7.4.80.0130.00319.39
7.4.70.0100.00616.37
7.4.60.0060.01016.68
7.4.50.0050.00316.51
7.4.40.0030.01422.52
7.4.30.0090.00916.54
7.4.10.0070.01114.86
7.4.00.0130.00415.05
7.3.330.0030.00313.34
7.3.320.0000.00513.30
7.3.310.0000.00716.18
7.3.300.0070.00016.23
7.3.290.0090.00616.41
7.3.280.0060.01216.38
7.3.270.0070.01917.40
7.3.260.0130.00818.24
7.3.250.0100.00816.67
7.3.240.0120.00616.32
7.3.230.0030.01416.50
7.3.210.0180.00316.53
7.3.200.0080.00819.39
7.3.190.0150.00616.34
7.3.180.0090.00616.42
7.3.170.0030.01316.52
7.3.160.0030.01316.35
7.3.130.0060.01214.87
7.3.120.0060.00814.70
7.3.110.0090.00314.54
7.3.100.0030.01215.11
7.3.90.0000.01415.10
7.3.80.0040.00714.86
7.3.70.0000.01314.97
7.3.60.0060.00914.96
7.3.50.0080.00814.96
7.3.40.0000.01714.88
7.3.30.0090.00914.74
7.3.20.0000.01616.67
7.3.10.0100.00716.46
7.3.00.0090.00916.24
7.2.330.0200.02916.88
7.2.320.0060.01616.77
7.2.310.0120.00916.57
7.2.300.0080.00816.88
7.2.290.0090.00916.82
7.2.260.0100.01015.16
7.2.250.0070.01015.05
7.2.240.0060.00914.96
7.2.230.0080.00814.77
7.2.220.0040.01115.22
7.2.210.0060.00615.22
7.2.200.0090.00615.21
7.2.190.0030.00615.27
7.2.180.0070.01115.04
7.2.170.0060.01215.20
7.2.160.0090.00615.11
7.2.150.0090.00016.91
7.2.140.0000.01016.97
7.2.130.0130.00816.75
7.2.120.0100.00516.44
7.2.110.0100.00416.60
7.2.100.0080.00816.34
7.2.90.0110.00516.65
7.2.80.0080.00516.69
7.2.70.0070.00716.48
7.2.60.0110.00716.79
7.2.50.0120.00516.68
7.2.40.0050.01016.53
7.2.30.0080.00816.67
7.2.20.0080.01016.78
7.2.10.0080.00716.92
7.2.00.0070.00817.71
7.1.330.0070.00715.70
7.1.320.0070.00715.73
7.1.310.0000.01315.54
7.1.300.0070.00715.86
7.1.290.0070.00315.51
7.1.280.0100.00715.66
7.1.270.0070.00715.85
7.1.260.0090.00315.86
7.1.250.0100.01015.59
7.1.240.0040.00715.77
7.1.230.0040.00815.91
7.1.220.0000.01315.89
7.1.210.0100.00315.70
7.1.200.0000.01715.55
7.1.190.0070.01015.85
7.1.180.0030.01315.75
7.1.170.0030.00915.88
7.1.160.0060.00615.85
7.1.150.0100.00315.77
7.1.140.0000.01315.96
7.1.130.0060.00315.85
7.1.120.0030.01015.86
7.1.110.0090.00616.00
7.1.100.0030.01217.14
7.1.90.0070.00715.50
7.1.80.0040.00815.52
7.1.70.0060.00716.32
7.1.60.0090.01017.64
7.1.50.0080.00316.37
7.1.40.0090.00915.80
7.1.30.0070.00415.88
7.1.20.0090.00015.69
7.1.10.0060.00915.82
7.1.00.0030.04218.94
7.0.330.0070.00715.10
7.0.320.0130.00015.45
7.0.310.0040.01115.41
7.0.300.0030.00715.44
7.0.290.0000.01415.14
7.0.280.0030.01015.18
7.0.270.0070.00715.24
7.0.260.0030.00615.32
7.0.250.0060.00915.48
7.0.240.0060.01215.51
7.0.230.0070.01115.52
7.0.220.0050.00515.53
7.0.210.0040.01115.43
7.0.200.0060.00616.21
7.0.190.0060.00915.64
7.0.180.0030.01315.26
7.0.170.0070.00415.31
7.0.160.0030.00915.45
7.0.150.0100.00315.32
7.0.140.0070.03818.75
7.0.130.0100.00715.39
7.0.120.0060.00315.56
7.0.110.0070.01015.38
7.0.100.0050.00515.20
7.0.90.0030.01015.53
7.0.80.0060.00615.44
7.0.70.0030.04418.56
7.0.60.0110.03318.68
7.0.50.0040.02518.97
7.0.40.0030.04716.76
7.0.30.0030.02816.85
7.0.20.0050.03116.85
7.0.10.0030.02316.81
7.0.00.0050.02416.81
5.6.400.0090.00614.67
5.6.390.0000.01014.71
5.6.380.0030.00614.79
5.6.370.0000.01214.04
5.6.360.0060.00614.47
5.6.350.0000.01314.29
5.6.340.0000.01714.48
5.6.330.0060.00914.48
5.6.320.0040.01214.17
5.6.310.0130.00314.59
5.6.300.0070.01014.33
5.6.290.0000.01714.18
5.6.280.0030.04317.65
5.6.270.0090.00614.46
5.6.260.0040.00814.76
5.6.250.0100.00714.52
5.6.240.0070.00714.60
5.6.230.0100.00714.61
5.6.220.0070.04517.62
5.6.210.0050.03717.46
5.6.200.0040.02517.91
5.6.190.0030.04517.74
5.6.180.0070.04217.63
5.6.170.0120.01817.68
5.6.160.0030.04817.76
5.6.150.0020.03317.69
5.6.140.0070.03917.85
5.6.130.0050.05017.71
5.6.120.0070.03517.72
5.6.110.0030.02817.74
5.6.100.0030.05017.73
5.6.90.0070.02517.68
5.6.80.0020.04417.42
5.6.70.0030.04517.31
5.6.60.0040.03517.34
5.6.50.0000.05217.31
5.6.40.0030.04817.51
5.6.30.0050.04317.35
5.6.20.0070.04717.35
5.6.10.0080.03517.46
5.6.00.0070.03417.63
5.5.380.0000.00814.49
5.5.370.0030.01014.45
5.5.360.0100.03517.36
5.5.350.0050.02817.37
5.5.340.0050.02517.70
5.5.330.0070.02617.50
5.5.320.0000.02717.77
5.5.310.0000.04717.72
5.5.300.0060.02817.61
5.5.290.0080.02517.66
5.5.280.0020.04717.59
5.5.270.0050.04817.61
5.5.260.0020.03417.65
5.5.250.0080.04117.29
5.5.240.0090.02317.22
5.5.230.0020.04417.17
5.5.220.0110.04017.18
5.5.210.0050.03517.13
5.5.200.0040.03317.25
5.5.190.0040.04617.17
5.5.180.0050.04017.31
5.5.170.0040.00414.43
5.5.160.0050.04417.08
5.5.150.0030.03117.19
5.5.140.0020.03217.38
5.5.130.0050.04317.16
5.5.120.0060.04217.27
5.5.110.0020.04617.25
5.5.100.0120.03317.04
5.5.90.0050.04717.30
5.5.80.0080.04217.33
5.5.70.0110.03617.03
5.5.60.0090.03017.27
5.5.50.0070.03917.26
5.5.40.0050.03317.14
5.5.30.0070.04017.26
5.5.20.0100.03817.20
5.5.10.0100.03717.21
5.5.00.0030.02617.15
5.4.450.0070.04516.13
5.4.440.0020.04016.11
5.4.430.0100.04016.08
5.4.420.0060.04016.04
5.4.410.0030.02715.98
5.4.400.0080.02815.97
5.4.390.0060.02515.94
5.4.380.0040.02515.90
5.4.370.0040.02415.90
5.4.360.0020.04215.80
5.4.350.0120.03515.93
5.4.340.0060.04315.91
5.4.330.0000.01212.72
5.4.320.0030.02415.94
5.4.310.0030.03515.91
5.4.300.0050.03815.92
5.4.290.0000.04515.79
5.4.280.0070.02615.96
5.4.270.0030.04315.88
5.4.260.0030.04315.81
5.4.250.0060.02415.86
5.4.240.0050.02915.88
5.4.230.0040.02315.97
5.4.220.0110.02715.92
5.4.210.0020.03715.88
5.4.200.0040.04415.92
5.4.190.0020.04615.96
5.4.180.0030.04215.90
5.4.170.0030.03815.87
5.4.160.0000.04615.82
5.4.150.0050.03415.87
5.4.140.0030.02714.53
5.4.130.0020.02914.57
5.4.120.0030.04214.57
5.4.110.0030.03614.61
5.4.100.0050.03914.61
5.4.90.0100.03314.59
5.4.80.0060.03514.60
5.4.70.0060.01814.58
5.4.60.0030.02514.48
5.4.50.0050.03714.56
5.4.40.0030.04014.63
5.4.30.0060.02514.51
5.4.20.0050.02614.60
5.4.10.0030.02514.58
5.4.00.0040.01814.30
5.3.290.0030.04713.72
5.3.280.0000.03913.70
5.3.270.0050.03813.73
5.3.260.0050.02513.63
5.3.250.0050.04313.69
5.3.240.0070.03713.66
5.3.230.0020.04213.62
5.3.220.0030.04013.60
5.3.210.0050.03513.63
5.3.200.0050.03813.63
5.3.190.0020.04213.67
5.3.180.0030.04213.67
5.3.170.0030.02613.63
5.3.160.0030.02213.62
5.3.150.0020.03113.61
5.3.140.0030.02513.64
5.3.130.0000.04113.61
5.3.120.0030.03813.71
5.3.110.0030.03713.62
5.3.100.0010.02413.41
5.3.90.0020.04213.36
5.3.80.0080.03513.41
5.3.70.0050.03213.38
5.3.60.0030.04113.32
5.3.50.0020.03913.30
5.3.40.0040.04113.36
5.3.30.0080.02813.36
5.3.20.0030.02113.17
5.3.10.0030.01813.18
5.3.00.0020.02313.21
5.2.170.0030.06012.20
5.2.160.0000.05012.20
5.2.150.0000.03712.20
5.2.140.0000.05712.20
5.2.130.0070.02312.20
5.2.120.0030.04312.20
5.2.110.0000.03012.20
5.2.100.0000.03012.20
5.2.90.0030.02712.20
5.2.80.0030.02712.20
5.2.70.0000.04312.20
5.2.60.0000.03312.20
5.2.50.0030.03012.20
5.2.40.0000.03012.20
5.2.30.0000.03012.20
5.2.20.0000.04312.20
5.2.10.0000.04012.20
5.2.00.0030.02712.20
5.1.60.0030.02312.20
5.1.50.0000.03012.20
5.1.40.0030.03012.20
5.1.30.0030.03712.20
5.1.20.0000.04712.20
5.1.10.0030.04012.20
5.1.00.0000.04012.20
5.0.50.0030.04312.20
5.0.40.0030.03012.20
5.0.30.0000.06712.20
5.0.20.0030.02712.20
5.0.10.0000.02312.20
5.0.00.0000.03012.20
4.4.90.0030.02312.20
4.4.80.0000.01712.20
4.4.70.0000.01312.20
4.4.60.0000.01712.20
4.4.50.0000.01312.20
4.4.40.0000.02712.20
4.4.30.0030.02712.20
4.4.20.0000.02712.20
4.4.10.0030.03312.20
4.4.00.0000.05712.20
4.3.110.0030.03312.20
4.3.100.0000.03312.20
4.3.90.0030.03012.20
4.3.80.0000.02312.20
4.3.70.0000.01712.20
4.3.60.0000.02312.20
4.3.50.0030.01312.20
4.3.40.0030.02012.20
4.3.30.0000.01712.20
4.3.20.0000.01712.20
4.3.10.0070.01712.20
4.3.00.0000.01312.20

preferences:
63.56 ms | 401 KiB | 5 Q