3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_between($the_string, $starts_with, $ends_with) { echo "before".$the_string."\n"; $the_string = substr($the_string,strpos ($the_string , $starts_with)); echo "now".$the_string."\n"; $temp = explode($starts_with, $the_string); $result_array = array(); $inc = 0; foreach($temp as $a_start_match) { echo $a_start_match."\n"; 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.0140.00318.18
8.3.50.0150.00521.99
8.3.40.0110.00718.70
8.3.30.0070.00718.71
8.3.20.0080.00018.57
8.3.10.0030.00521.16
8.3.00.0000.00823.66
8.2.180.0070.00716.63
8.2.170.0120.00322.96
8.2.160.0070.00720.30
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0060.00319.77
8.2.110.0030.00720.39
8.2.100.0040.00817.84
8.2.90.0080.00019.27
8.2.80.0050.00317.97
8.2.70.0050.00617.63
8.2.60.0050.00317.93
8.2.50.0080.00018.07
8.2.40.0000.00818.09
8.2.30.0000.00721.26
8.2.20.0000.00817.63
8.2.10.0040.00417.62
8.2.00.0050.00317.82
8.1.280.0040.01125.92
8.1.270.0040.00423.99
8.1.260.0000.00926.35
8.1.250.0000.00728.09
8.1.240.0100.00022.23
8.1.230.0060.00620.97
8.1.220.0030.00618.77
8.1.210.0000.00818.88
8.1.200.0030.00617.35
8.1.190.0030.00617.52
8.1.180.0080.00018.10
8.1.170.0000.00818.59
8.1.160.0020.00518.81
8.1.150.0040.00418.64
8.1.140.0040.00417.38
8.1.130.0070.00017.75
8.1.120.0000.00717.34
8.1.110.0000.00717.41
8.1.100.0080.00017.50
8.1.90.0000.00717.36
8.1.80.0070.00017.53
8.1.70.0000.00717.44
8.1.60.0050.00217.57
8.1.50.0070.00017.49
8.1.40.0000.00817.57
8.1.30.0050.00217.64
8.1.20.0000.00917.55
8.1.10.0050.00317.53
8.1.00.0000.00717.49
8.0.300.0040.00419.90
8.0.290.0040.00417.05
8.0.280.0040.00418.32
8.0.270.0000.00717.18
8.0.260.0000.00616.85
8.0.250.0020.00517.00
8.0.240.0040.00416.85
8.0.230.0030.00316.96
8.0.220.0060.00316.87
8.0.210.0040.00416.86
8.0.200.0080.00016.83
8.0.190.0030.00616.96
8.0.180.0070.00016.95
8.0.170.0070.00016.96
8.0.160.0040.00416.77
8.0.150.0040.00416.82
8.0.140.0000.00916.84
8.0.130.0050.00013.32
8.0.120.0030.00516.90
8.0.110.0070.00016.75
8.0.100.0000.00816.68
8.0.90.0000.00816.78
8.0.80.0060.00916.95
8.0.70.0020.00516.89
8.0.60.0000.00716.78
8.0.50.0040.00416.95
8.0.30.0120.00717.10
8.0.20.0090.01117.40
8.0.10.0030.00517.05
8.0.00.0110.00516.74
7.4.330.0020.00214.78
7.4.320.0030.00316.56
7.4.300.0000.00716.61
7.4.290.0000.00716.44
7.4.280.0000.00716.59
7.4.270.0030.00316.65
7.4.260.0030.00313.40
7.4.250.0000.00716.55
7.4.240.0030.00316.53
7.4.230.0070.00016.45
7.4.220.0090.00916.55
7.4.210.0090.00516.52
7.4.200.0030.00316.41
7.4.190.0030.00316.70
7.4.160.0100.00616.42
7.4.150.0110.01117.40
7.4.140.0060.01317.86
7.4.130.0110.00616.52
7.4.120.0120.00516.45
7.4.110.0000.02516.62
7.4.100.0090.00916.45
7.4.90.0110.00816.38
7.4.80.0060.01219.37
7.4.70.0120.00916.57
7.4.60.0060.00916.46
7.4.50.0030.00616.39
7.4.40.0120.00622.52
7.4.30.0110.00716.67
7.4.10.0060.00915.02
7.4.00.0080.00614.96
7.3.330.0000.00513.20
7.3.320.0090.00413.30
7.3.310.0000.00716.21
7.3.300.0040.00416.23
7.3.290.0150.00616.30
7.3.280.0120.00616.36
7.3.270.0030.01417.40
7.3.260.0090.00918.24
7.3.250.0060.01116.37
7.3.240.0030.01416.39
7.3.230.0100.00716.60
7.3.210.0170.00016.71
7.3.200.0170.00019.39
7.3.190.0150.00616.31
7.3.180.0110.00816.23
7.3.170.0130.00316.39
7.3.160.0150.00016.39
7.3.130.0030.01114.80
7.3.120.0120.00614.96
7.3.110.0060.00914.83
7.3.100.0030.01014.75
7.3.90.0070.01014.72
7.3.80.0070.00715.09
7.3.70.0060.00915.00
7.3.60.0060.00914.66
7.3.50.0040.00814.80
7.3.40.0040.00814.83
7.3.30.0090.00314.95
7.3.20.0000.01216.75
7.3.10.0030.01016.85
7.3.00.0030.00716.63
7.2.330.0130.00416.83
7.2.320.0080.00816.80
7.2.310.0130.00616.73
7.2.300.0080.00916.55
7.2.290.0060.01716.68
7.2.260.0130.00615.07
7.2.250.0140.00715.08
7.2.240.0070.00715.25
7.2.230.0070.00715.30
7.2.220.0030.01215.09
7.2.210.0000.01514.99
7.2.200.0030.01215.00
7.2.190.0030.00615.13
7.2.180.0090.00314.81
7.2.170.0030.01015.12
7.2.160.0100.00314.84
7.2.150.0030.00616.90
7.2.140.0030.01217.02
7.2.130.0070.00716.88
7.2.120.0030.00817.07
7.2.110.0060.00316.98
7.2.100.0040.01116.71
7.2.90.0060.00617.03
7.2.80.0060.00617.07
7.2.70.0090.00617.02
7.2.60.0000.01116.88
7.2.50.0070.00717.00
7.2.40.0030.00917.01
7.2.30.0080.00817.02
7.2.20.0110.00317.00
7.2.10.0100.00716.96
7.2.00.0050.01218.09
7.1.330.0040.00816.11
7.1.320.0000.01015.80
7.1.310.0030.01015.87
7.1.300.0070.00315.44
7.1.290.0030.01415.69
7.1.280.0050.00515.52
7.1.270.0000.00915.61
7.1.260.0050.00515.91
7.1.250.0050.00515.88
7.1.240.0060.00616.02
7.1.230.0000.00915.92
7.1.220.0030.01015.85
7.1.210.0030.01015.82
7.1.200.0060.00915.78
7.1.190.0030.00615.80
7.1.180.0000.01315.78
7.1.170.0090.00315.78
7.1.160.0040.00815.97
7.1.150.0080.00015.91
7.1.140.0120.00615.71
7.1.130.0040.01115.54
7.1.120.0100.00715.62
7.1.110.0080.00415.54
7.1.100.0060.00917.00
7.1.90.0000.01315.93
7.1.80.0040.00815.61
7.1.70.0070.00616.49
7.1.60.0080.00817.61
7.1.50.0110.00916.49
7.1.40.0060.01015.45
7.1.30.0060.00615.62
7.1.20.0060.00315.53
7.1.10.0070.00715.92
7.1.00.0050.01819.12
7.0.330.0070.00715.37
7.0.320.0040.01115.40
7.0.310.0030.00715.42
7.0.300.0030.00615.43
7.0.290.0100.00315.17
7.0.280.0000.01115.34
7.0.270.0000.01515.45
7.0.260.0070.00415.43
7.0.250.0030.00615.57
7.0.240.0060.00615.39
7.0.230.0090.00415.54
7.0.220.0000.01315.40
7.0.210.0030.00815.22
7.0.200.0050.00615.97
7.0.190.0110.00415.55
7.0.180.0030.01315.59
7.0.170.0040.00715.52
7.0.160.0040.01115.47
7.0.150.0090.00615.51
7.0.140.0060.03518.74
7.0.130.0040.00415.44
7.0.120.0040.00815.21
7.0.110.0040.01115.49
7.0.100.0030.01315.45
7.0.90.0070.00315.50
7.0.80.0040.00715.23
7.0.70.0020.03518.56
7.0.60.0050.04718.59
7.0.50.0080.02318.87
7.0.40.0080.02516.68
7.0.30.0030.04016.65
7.0.20.0090.03216.73
7.0.10.0040.02216.71
7.0.00.0030.04716.81
5.6.400.0060.00614.42
5.6.390.0000.01614.68
5.6.380.0060.00614.32
5.6.370.0060.00914.36
5.6.360.0000.01214.53
5.6.350.0150.00314.35
5.6.340.0000.00914.73
5.6.330.0110.00414.68
5.6.320.0000.01114.29
5.6.310.0090.00314.49
5.6.300.0030.01014.38
5.6.290.0030.01014.13
5.6.280.0070.03617.86
5.6.270.0030.00814.56
5.6.260.0070.00414.18
5.6.250.0070.00714.41
5.6.240.0030.00714.43
5.6.230.0030.01014.53
5.6.220.0030.03817.61
5.6.210.0000.03617.51
5.6.200.0130.02117.69
5.6.190.0080.03617.74
5.6.180.0070.04017.82
5.6.170.0020.03517.62
5.6.160.0050.03717.73
5.6.150.0040.02617.66
5.6.140.0030.04017.82
5.6.130.0070.04417.63
5.6.120.0050.03517.81
5.6.110.0050.03117.88
5.6.100.0060.04417.71
5.6.90.0060.02517.71
5.6.80.0090.02217.42
5.6.70.0090.01317.35
5.6.60.0060.01817.46
5.6.50.0020.02617.46
5.6.40.0040.02217.56
5.6.30.0070.02717.25
5.6.20.0030.04817.33
5.6.10.0030.03617.43
5.6.00.0030.04517.28
5.5.380.0040.00814.52
5.5.370.0000.01114.41
5.5.360.0020.04117.31
5.5.350.0050.04217.18
5.5.340.0100.02617.52
5.5.330.0030.04517.56
5.5.320.0070.03717.59
5.5.310.0050.04517.64
5.5.300.0050.04217.64
5.5.290.0040.04717.38
5.5.280.0050.03717.57
5.5.270.0060.04017.61
5.5.260.0020.05017.46
5.5.250.0050.04117.52
5.5.240.0030.03517.23
5.5.230.0070.02717.31
5.5.220.0070.04217.21
5.5.210.0050.02217.33
5.5.200.0020.03217.24
5.5.190.0100.03517.29
5.5.180.0040.04617.07
5.5.170.0030.00614.48
5.5.160.0050.02517.32
5.5.150.0080.03517.31
5.5.140.0050.04017.26
5.5.130.0020.02617.21
5.5.120.0030.02517.14
5.5.110.0110.03817.12
5.5.100.0000.03417.36
5.5.90.0030.02817.07
5.5.80.0020.03017.16
5.5.70.0050.02117.27
5.5.60.0020.02517.29
5.5.50.0020.02417.14
5.5.40.0020.02717.19
5.5.30.0000.02617.21
5.5.20.0020.02417.27
5.5.10.0050.02217.10
5.5.00.0140.01717.12
5.4.450.0070.03215.38
5.4.440.0090.03515.45
5.4.430.0070.03715.45
5.4.420.0050.03215.50
5.4.410.0030.04315.38
5.4.400.0030.02015.36
5.4.390.0000.02315.35
5.4.380.0030.02015.34
5.4.370.0030.02915.35
5.4.360.0050.04315.37
5.4.350.0000.04415.31
5.4.340.0030.02715.40
5.4.330.0050.00311.57
5.4.320.0110.01815.28
5.4.310.0030.04515.29
5.4.300.0030.03915.29
5.4.290.0020.02815.24
5.4.280.0050.04315.37
5.4.270.0070.02615.22
5.4.260.0020.02115.23
5.4.250.0050.03115.35
5.4.240.0030.03815.22
5.4.230.0040.02715.20
5.4.220.0030.02315.30
5.4.210.0020.02215.35
5.4.200.0050.02215.40
5.4.190.0040.02115.39
5.4.180.0030.02715.29
5.4.170.0040.02615.24
5.4.160.0030.02615.22
5.4.150.0020.02415.29
5.4.140.0040.02213.89
5.4.130.0020.02213.97
5.4.120.0030.02313.93
5.4.110.0060.03514.03
5.4.100.0030.02814.01
5.4.90.0060.03614.01
5.4.80.0050.03113.95
5.4.70.0020.03714.02
5.4.60.0000.03813.98
5.4.50.0050.03213.98
5.4.40.0020.02214.00
5.4.30.0040.03913.96
5.4.20.0060.01813.99
5.4.10.0030.02013.96
5.4.00.0000.02513.70
5.3.290.0020.02513.22
5.3.280.0050.03013.22
5.3.270.0050.03513.22
5.3.260.0030.02313.22
5.3.250.0030.02813.22
5.3.240.0020.03913.22
5.3.230.0020.03113.22
5.3.220.0020.04013.22
5.3.210.0030.02313.22
5.3.200.0050.02513.22
5.3.190.0030.02313.22
5.3.180.0020.04213.22
5.3.170.0050.04213.22
5.3.160.0040.02913.22
5.3.150.0030.03813.22
5.3.140.0070.03313.22
5.3.130.0040.01813.22
5.3.120.0030.03813.22
5.3.110.0030.02113.22
5.3.100.0000.02313.22
5.3.90.0030.04113.22
5.3.80.0080.01813.22
5.3.70.0000.04013.22
5.3.60.0040.03813.22
5.3.50.0070.02013.22
5.3.40.0020.02513.22
5.3.30.0000.02513.22
5.3.20.0000.02113.22
5.3.10.0070.02513.22
5.3.00.0060.01913.22
5.2.170.0000.07014.88
5.2.160.0000.05714.88
5.2.150.0000.03314.88
5.2.140.0000.03014.88
5.2.130.0030.04314.88
5.2.120.0000.04714.88
5.2.110.0030.05314.88
5.2.100.0000.03314.88
5.2.90.0030.05014.88
5.2.80.0000.06014.88
5.2.70.0000.05314.88
5.2.60.0100.04314.88
5.2.50.0000.04014.88
5.2.40.0030.03714.88
5.2.30.0000.04014.88
5.2.20.0000.03014.88
5.2.10.0030.05014.88
5.2.00.0070.05714.88
5.1.60.0000.04014.88
5.1.50.0100.04314.88
5.1.40.0030.05314.88
5.1.30.0030.03314.88
5.1.20.0030.04014.88
5.1.10.0000.04314.88
5.1.00.0000.05714.88
5.0.50.0000.05014.88
5.0.40.0030.03714.88
5.0.30.0070.03714.88
5.0.20.0000.02014.88
5.0.10.0030.04314.88
5.0.00.0030.05714.88
4.4.90.0070.03014.88
4.4.80.0000.02314.88
4.4.70.0000.02714.88
4.4.60.0000.03714.88
4.4.50.0000.02714.88
4.4.40.0000.03014.88
4.4.30.0030.02714.88
4.4.20.0070.02714.88
4.4.10.0000.02714.88
4.4.00.0000.05314.88
4.3.110.0000.02714.88
4.3.100.0000.02014.88
4.3.90.0000.02014.88
4.3.80.0000.05314.88
4.3.70.0000.02314.88
4.3.60.0000.03714.88
4.3.50.0030.03014.88
4.3.40.0030.05014.88
4.3.30.0030.03314.88
4.3.20.0000.03714.88
4.3.10.0000.04014.88
4.3.00.0000.03714.88

preferences:
49.63 ms | 401 KiB | 5 Q