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 = array_filter(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)) { $a_start_match = substr($a_start_match,0,strlen($a_start_match)-strpos($a_start_match , $ends_with)); echo "testing ".$a_start_match."\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.00718.56
8.3.50.0130.00521.97
8.3.40.0170.00318.71
8.3.30.0080.00619.00
8.3.20.0040.00420.34
8.3.10.0070.00023.66
8.3.00.0040.00422.51
8.2.180.0110.00718.29
8.2.170.0040.01122.96
8.2.160.0140.00022.21
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0060.00319.23
8.2.110.0000.00922.20
8.2.100.0090.00917.77
8.2.90.0030.00517.75
8.2.80.0000.00818.04
8.2.70.0090.00017.80
8.2.60.0030.00618.05
8.2.50.0040.00418.10
8.2.40.0080.00020.47
8.2.30.0030.00818.19
8.2.20.0070.00017.71
8.2.10.0050.00317.76
8.2.00.0000.00717.80
8.1.280.0110.00425.92
8.1.270.0030.00623.87
8.1.260.0000.00726.35
8.1.250.0070.00028.09
8.1.240.0080.00023.96
8.1.230.0070.00320.98
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0000.00817.48
8.1.190.0080.00017.35
8.1.180.0040.00418.10
8.1.170.0000.00818.64
8.1.160.0000.00721.92
8.1.150.0030.00818.52
8.1.140.0000.00917.44
8.1.130.0000.00717.70
8.1.120.0070.00017.32
8.1.110.0050.00317.37
8.1.100.0040.00417.49
8.1.90.0030.00317.42
8.1.80.0000.00817.50
8.1.70.0030.00317.36
8.1.60.0040.00417.61
8.1.50.0030.00517.41
8.1.40.0040.00417.47
8.1.30.0050.00317.45
8.1.20.0040.00417.67
8.1.10.0050.00317.54
8.1.00.0050.00317.43
8.0.300.0070.00019.55
8.0.290.0050.00316.63
8.0.280.0030.00318.39
8.0.270.0050.00317.29
8.0.260.0030.00316.78
8.0.250.0070.00016.96
8.0.240.0050.00516.93
8.0.230.0080.00016.97
8.0.220.0040.00416.80
8.0.210.0000.00716.79
8.0.200.0000.00716.83
8.0.190.0080.00017.00
8.0.180.0000.00816.83
8.0.170.0060.00316.96
8.0.160.0000.00716.85
8.0.150.0030.00316.88
8.0.140.0050.00216.86
8.0.130.0040.00413.25
8.0.120.0060.00316.75
8.0.110.0000.00916.90
8.0.100.0000.00716.82
8.0.90.0000.00716.83
8.0.80.0060.00916.82
8.0.70.0080.00016.88
8.0.60.0000.00716.68
8.0.50.0070.00017.02
8.0.30.0110.00817.07
8.0.20.0110.00817.40
8.0.10.0070.00016.89
8.0.00.0120.01816.93
7.4.330.0000.00615.12
7.4.320.0000.00716.52
7.4.300.0030.00316.59
7.4.290.0000.00716.61
7.4.280.0000.00716.49
7.4.270.0040.00416.65
7.4.260.0030.00316.55
7.4.250.0000.00716.34
7.4.240.0030.00416.52
7.4.230.0070.00016.68
7.4.220.0100.00716.61
7.4.210.0060.00816.60
7.4.200.0000.00716.61
7.4.190.0030.00316.57
7.4.160.0070.00716.35
7.4.150.0090.00917.40
7.4.140.0060.01117.86
7.4.130.0090.00916.48
7.4.120.0140.00616.68
7.4.110.0130.00416.55
7.4.100.0140.01116.60
7.4.90.0160.00016.52
7.4.80.0090.00916.49
7.4.70.0060.01016.61
7.4.60.0120.00916.45
7.4.50.0040.00016.35
7.4.40.0070.00722.77
7.4.30.0120.00316.31
7.4.00.0070.00715.02
7.3.330.0000.00613.14
7.3.320.0050.00013.11
7.3.310.0070.00016.41
7.3.300.0000.00716.38
7.3.290.0040.01716.37
7.3.280.0060.01216.34
7.3.270.0070.01017.40
7.3.260.0140.00616.43
7.3.250.0060.01416.63
7.3.240.0090.00916.41
7.3.230.0100.00616.44
7.3.210.0130.00616.28
7.3.200.0090.00619.39
7.3.190.0100.00616.60
7.3.180.0100.00716.47
7.3.170.0120.00916.53
7.3.160.0070.01016.44
7.3.120.0060.00914.83
7.3.110.0040.01514.64
7.3.100.0030.01214.75
7.3.90.0070.00714.91
7.3.80.0060.00615.04
7.3.70.0090.00614.94
7.3.60.0060.00614.61
7.3.50.0120.00314.97
7.3.40.0000.01114.99
7.3.30.0030.01314.96
7.3.20.0090.00916.91
7.3.10.0030.01516.44
7.3.00.0070.00416.46
7.2.330.0070.01116.55
7.2.320.0040.01416.82
7.2.310.0130.00716.55
7.2.300.0100.00716.57
7.2.290.0100.00616.68
7.2.250.0030.01414.95
7.2.240.0100.00715.05
7.2.230.0110.00014.96
7.2.220.0140.00414.68
7.2.210.0030.01015.13
7.2.200.0090.00614.94
7.2.190.0090.00614.96
7.2.180.0070.01115.11
7.2.170.0040.00715.09
7.2.60.0070.00717.04
7.2.50.0090.00317.01
7.1.330.0000.01515.88
7.1.320.0060.00916.02
7.1.310.0100.00615.80
7.1.300.0070.00315.79
7.1.290.0090.00615.58
7.1.280.0090.00615.99
7.1.270.0030.01415.87
7.1.260.0090.00615.79
7.1.200.0070.00715.75
7.1.70.0120.00316.94
7.1.60.0070.00417.27
7.1.50.0120.00917.11
7.1.00.0000.07722.36
7.0.200.0100.00616.86
7.0.140.0030.07022.07
7.0.120.0070.07022.06
7.0.110.0070.07322.21
7.0.100.0030.07322.16
7.0.90.0000.07722.07
7.0.80.0070.06022.14
7.0.70.0000.07022.05
7.0.60.0070.06321.95
7.0.50.0000.07722.09
7.0.40.0030.07322.18
7.0.30.0100.06721.94
7.0.20.0030.07322.07
7.0.10.0030.07022.19
7.0.00.0100.06722.06
5.6.260.0070.07021.06
5.6.250.0030.07320.99
5.6.240.0000.07021.01
5.6.230.0030.07721.10
5.6.220.0030.07321.06
5.6.210.0000.07320.96
5.6.200.0000.07721.09
5.6.190.0000.06020.75
5.6.180.0070.06721.07
5.6.170.0070.07021.02
5.6.160.0030.07321.09
5.6.150.0030.07021.02
5.6.140.0070.07020.86
5.6.130.0030.07321.02
5.6.120.0000.08020.83
5.6.110.0030.07721.00
5.6.100.0070.07320.74
5.6.90.0070.07021.03
5.6.80.0030.07020.43
5.6.70.0070.06720.21
5.6.60.0030.07320.28
5.6.50.0100.06020.43
5.6.40.0030.06320.37
5.6.30.0000.07720.42
5.6.20.0100.06320.20
5.6.10.0030.04320.42
5.6.00.0000.07320.43
5.5.380.0070.06717.54
5.5.370.0000.07317.70
5.5.360.0000.06717.68
5.5.350.0030.06717.56
5.5.340.0030.07317.93
5.5.330.0000.07317.83
5.5.320.0070.06717.93
5.5.310.0030.07018.05
5.5.300.0030.07318.11
5.5.290.0030.07317.91
5.5.280.0030.07718.09
5.5.270.0070.06018.22
5.5.260.0070.07017.90
5.5.250.0000.07317.64
5.5.240.0030.07017.61
5.5.230.0000.07317.48
5.5.220.0070.06717.59
5.5.210.0030.07017.30
5.5.200.0030.06717.30
5.5.190.0070.06017.45
5.5.180.0000.06317.58
5.5.160.0030.06317.43
5.5.150.0000.06317.44
5.5.140.0070.05317.47
5.5.130.0000.06717.28
5.5.120.0070.06017.26
5.5.110.0130.05717.39
5.5.100.0130.06017.18
5.5.90.0000.07017.48
5.5.80.0030.05317.30
5.5.70.0030.07017.46
5.5.60.0030.06017.46
5.5.50.0030.06317.31
5.5.40.0070.05317.37
5.5.30.0000.07017.33
5.5.20.0030.06717.21
5.5.10.0000.06317.17
5.5.00.0030.06717.36
5.4.450.0130.05019.34
5.4.440.0000.07319.26
5.4.430.0030.07019.33
5.4.420.0070.06319.46
5.4.410.0070.06319.42
5.4.400.0100.06019.16
5.4.390.0000.07019.02
5.4.380.0100.06018.97
5.4.370.0070.06319.00
5.4.360.0000.07019.09
5.4.350.0030.06318.94
5.4.340.0000.07019.01
5.4.320.0000.07019.17
5.4.310.0030.06718.99
5.4.300.0000.07019.17
5.4.290.0030.06019.30
5.4.280.0070.06719.25
5.4.270.0000.07019.02
5.4.260.0000.07019.33
5.4.250.0030.06019.13
5.4.240.0000.06319.15
5.4.230.0130.05719.08
5.4.220.0000.07319.13
5.4.210.0000.07019.32
5.4.200.0030.06719.01
5.4.190.0000.06719.16
5.4.180.0030.06719.32
5.4.170.0030.06719.32
5.4.160.0000.07019.07
5.4.150.0000.06718.99
5.4.140.0100.06016.63
5.4.130.0000.06716.52
5.4.120.0070.06016.32
5.4.110.0070.06316.55
5.4.100.0030.06016.41
5.4.90.0070.06016.37
5.4.80.0000.06016.48
5.4.70.0000.06016.39
5.4.60.0070.06016.35
5.4.50.0030.06316.28
5.4.40.0030.06316.68
5.4.30.0000.06716.43
5.4.20.0000.06316.38
5.4.10.0030.06716.51
5.4.00.0000.06315.97
5.3.290.0070.06314.68
5.3.280.0070.06014.69
5.3.270.0070.06714.57
5.3.260.0000.07314.64
5.3.250.0000.07014.62
5.3.240.0030.06714.58
5.3.230.0030.06314.62
5.3.220.0030.06014.80
5.3.210.0070.06714.60
5.3.200.0000.06714.59
5.3.190.0000.07014.58
5.3.180.0030.05014.70
5.3.170.0070.06314.70
5.3.160.0030.06314.70
5.3.150.0000.07014.60
5.3.140.0030.06314.71
5.3.130.0030.07014.69
5.3.120.0030.06314.57
5.3.110.0070.06714.69
5.3.100.0100.05014.06
5.3.90.0000.06714.06
5.3.80.0070.05714.06
5.3.70.0000.06013.88
5.3.60.0070.06013.98
5.3.50.0000.06714.04
5.3.40.0000.06714.19
5.3.30.0030.06314.05
5.3.20.0000.05713.71
5.3.10.0000.06713.90
5.3.00.0030.06313.51
5.2.170.0000.05711.29
5.2.160.0030.04711.38
5.2.150.0030.05711.17
5.2.140.0030.05711.14
5.2.130.0030.05311.11
5.2.120.0000.05711.19
5.2.110.0000.05711.13
5.2.100.0000.05311.15
5.2.90.0070.05011.12
5.2.80.0030.04711.08
5.2.70.0000.05311.07
5.2.60.0070.05011.07
5.2.50.0070.05311.16
5.2.40.0000.05711.00
5.2.30.0000.05011.08
5.2.20.0030.05311.10
5.2.10.0030.05010.73
5.2.00.0070.05010.73
5.1.60.0030.04010.08
5.1.50.0000.0479.99
5.1.40.0100.0379.96
5.1.30.0070.04710.41
5.1.20.0000.04310.45
5.1.10.0030.04310.00
5.1.00.0030.04710.16
5.0.50.0000.0379.75
5.0.40.0000.0409.75
5.0.30.0000.0579.75
5.0.20.0030.0379.75
5.0.10.0030.0379.75
5.0.00.0000.0579.75
4.4.90.0000.0309.75
4.4.80.0000.0309.75
4.4.70.0030.0279.75
4.4.60.0030.0279.75
4.4.50.0000.0279.75
4.4.40.0030.0479.75
4.4.30.0030.0309.75
4.4.20.0030.0309.75
4.4.10.0000.0309.75
4.4.00.0000.0409.75
4.3.110.0000.0339.75
4.3.100.0000.0309.75
4.3.90.0000.0309.75
4.3.80.0000.0479.75
4.3.70.0000.0309.75
4.3.60.0030.0279.75
4.3.50.0000.0339.75
4.3.40.0000.0479.75
4.3.30.0030.0279.75
4.3.20.0030.0279.75
4.3.10.0000.0279.75
4.3.00.0000.0309.75

preferences:
47.96 ms | 401 KiB | 5 Q