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) { if (strlen($ends_with) <= strlen($a_start_match)) { 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.0150.00618.56
8.3.50.0170.00222.05
8.3.40.0040.01118.66
8.3.30.0040.01118.71
8.3.20.0070.01118.60
8.3.10.0000.00821.13
8.3.00.0020.00523.71
8.2.180.0070.00716.38
8.2.170.0090.00622.96
8.2.160.0070.00720.52
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00421.14
8.2.110.0000.01020.52
8.2.100.0000.01117.79
8.2.90.0050.00319.21
8.2.80.0050.00317.97
8.2.70.0000.00817.50
8.2.60.0000.00818.16
8.2.50.0040.00418.07
8.2.40.0000.00818.22
8.2.30.0050.00321.09
8.2.20.0040.00417.57
8.2.10.0070.00017.74
8.2.00.0040.00717.86
8.1.280.0060.01225.92
8.1.270.0000.00823.99
8.1.260.0130.00326.35
8.1.250.0000.00728.09
8.1.240.0060.00322.59
8.1.230.0080.00420.79
8.1.220.0060.00318.77
8.1.210.0040.00418.91
8.1.200.0060.00317.35
8.1.190.0000.00817.51
8.1.180.0050.00318.10
8.1.170.0040.00418.58
8.1.160.0000.00718.96
8.1.150.0070.00318.55
8.1.140.0040.00417.54
8.1.130.0000.00717.88
8.1.120.0040.00417.37
8.1.110.0000.00717.43
8.1.100.0070.00017.48
8.1.90.0000.00717.49
8.1.80.0000.00717.47
8.1.70.0000.00717.45
8.1.60.0050.00517.55
8.1.50.0030.00517.45
8.1.40.0000.00717.52
8.1.30.0080.00017.64
8.1.20.0080.00017.67
8.1.10.0000.00717.47
8.1.00.0040.00417.50
8.0.300.0040.00420.10
8.0.290.0030.00516.93
8.0.280.0080.00018.39
8.0.270.0060.00317.18
8.0.260.0000.00616.83
8.0.250.0040.00416.98
8.0.240.0000.00716.82
8.0.230.0000.00716.88
8.0.220.0000.00716.84
8.0.210.0040.00416.91
8.0.200.0000.00617.00
8.0.190.0040.00416.89
8.0.180.0000.00716.94
8.0.170.0000.00716.88
8.0.160.0040.00416.89
8.0.150.0040.00416.81
8.0.140.0070.00016.69
8.0.130.0050.00013.24
8.0.120.0030.00516.78
8.0.110.0070.00016.73
8.0.100.0040.00416.85
8.0.90.0000.00716.80
8.0.80.0060.00916.96
8.0.70.0050.00216.86
8.0.60.0080.00016.82
8.0.50.0000.00716.89
8.0.30.0100.00816.88
8.0.20.0100.00817.40
8.0.10.0000.00817.09
8.0.00.0110.00816.76
7.4.330.0000.00514.83
7.4.320.0000.00716.57
7.4.300.0030.00316.56
7.4.290.0070.00016.46
7.4.280.0000.00816.50
7.4.270.0070.00016.54
7.4.260.0050.00013.40
7.4.250.0050.00316.46
7.4.240.0000.00716.52
7.4.230.0000.00716.47
7.4.220.0130.00316.57
7.4.210.0100.00516.56
7.4.200.0030.00416.63
7.4.190.0030.00316.66
7.4.160.0130.00316.39
7.4.150.0130.00317.40
7.4.140.0150.00817.86
7.4.130.0100.00816.53
7.4.120.0070.01316.57
7.4.110.0100.00616.51
7.4.100.0140.00416.43
7.4.90.0070.01116.57
7.4.80.0070.01019.39
7.4.70.0120.00616.65
7.4.60.0120.01216.55
7.4.50.0060.00316.50
7.4.40.0080.00822.77
7.4.30.0030.01316.57
7.4.00.0050.01314.97
7.3.330.0020.00213.23
7.3.320.0000.00513.27
7.3.310.0070.00016.42
7.3.300.0060.00016.38
7.3.290.0070.01316.32
7.3.280.0070.01016.34
7.3.270.0130.00917.40
7.3.260.0110.00918.24
7.3.250.0040.01416.41
7.3.240.0120.00616.63
7.3.230.0070.01016.63
7.3.210.0040.01416.53
7.3.200.0080.01419.39
7.3.190.0150.00616.65
7.3.180.0120.00416.49
7.3.170.0090.01216.45
7.3.160.0080.00816.45
7.3.120.0080.00714.74
7.3.110.0070.00714.90
7.3.100.0040.01114.63
7.3.90.0100.00314.83
7.3.80.0030.01014.80
7.3.70.0040.00814.83
7.3.60.0070.00714.97
7.3.50.0030.01414.84
7.3.40.0060.00314.70
7.3.30.0070.00714.81
7.3.20.0030.00616.76
7.3.10.0030.00616.57
7.3.00.0050.00816.50
7.2.330.0070.01016.66
7.2.320.0120.00616.71
7.2.310.0070.01016.38
7.2.300.0060.01016.56
7.2.290.0130.00316.71
7.2.250.0030.01315.21
7.2.240.0100.01015.09
7.2.230.0040.01415.22
7.2.220.0030.01115.18
7.2.210.0000.01614.82
7.2.200.0030.01014.84
7.2.190.0060.00614.81
7.2.180.0130.00315.14
7.2.170.0000.01014.78
7.2.130.0070.01016.18
7.2.120.0080.00816.32
7.2.110.0070.00716.32
7.2.100.0070.00416.85
7.2.90.0030.01016.40
7.2.80.0100.00616.29
7.2.70.0090.00416.36
7.2.60.0070.00616.79
7.2.50.0100.00316.62
7.2.40.0030.01216.84
7.2.30.0110.00816.57
7.2.20.0130.00816.48
7.2.10.0040.01416.89
7.2.00.0050.01018.27
7.1.330.0070.00715.92
7.1.320.0040.00715.63
7.1.310.0030.00615.90
7.1.300.0060.01215.99
7.1.290.0090.00015.63
7.1.280.0040.00915.82
7.1.270.0040.01215.81
7.1.260.0040.00716.02
7.1.250.0090.00315.15
7.1.200.0030.01215.72
7.1.100.0060.00317.75
7.1.70.0030.01017.37
7.1.60.0070.01119.40
7.1.50.0110.01417.01
7.1.00.0000.07322.40
7.0.200.0000.00816.94
7.0.140.0100.06322.11
7.0.60.0030.05020.02
7.0.50.0030.08017.73
7.0.40.0070.08320.16
7.0.30.0200.06020.07
7.0.20.0170.04720.26
7.0.10.0170.08020.07
7.0.00.0030.04320.05
5.6.280.0070.07021.11
5.6.210.0100.05320.67
5.6.200.0330.03318.19
5.6.190.0030.05320.67
5.6.180.0200.07020.77
5.6.170.0300.02720.51
5.6.160.0000.09020.62
5.6.150.0100.07318.22
5.6.140.0000.05318.17
5.6.130.0100.07718.17
5.6.120.0100.07321.00
5.6.110.0170.07721.10
5.6.100.0100.04020.98
5.6.90.0100.08020.98
5.6.80.0030.09020.41
5.5.350.0070.08020.41
5.5.340.0070.04317.99
5.5.330.0000.04720.40
5.5.320.0200.04720.32
5.5.310.0400.07020.38
5.5.300.0030.05018.02
5.5.290.0070.06017.95
5.5.280.0030.06020.83
5.5.270.0170.07720.68
5.5.260.0100.07720.87
5.5.250.0070.06320.59
5.5.240.0000.03320.07
5.4.450.1870.05719.47
5.4.440.1900.04019.27
5.4.430.1630.05019.54
5.4.420.1170.04719.56
5.4.410.1600.04019.38
5.4.400.2000.05018.99
5.4.390.1570.04318.99
5.4.380.0100.03718.87
5.4.370.0070.07319.24
5.4.360.0770.07019.31
5.4.350.1800.04719.15
5.4.340.1630.03719.22
5.4.320.1670.03718.96
5.4.310.1530.04019.24
5.4.300.1830.04319.06
5.4.290.1670.03318.99
5.4.280.1870.04019.16
5.4.270.1770.05019.09
5.4.260.1570.04319.14
5.4.250.1670.04719.13
5.4.240.1230.04318.97
5.4.230.0070.03718.98
5.4.220.0070.07319.18
5.4.210.1400.04019.21
5.4.200.1800.05319.23
5.4.190.1800.04019.30
5.4.180.1670.05019.13
5.4.170.1800.04719.22
5.4.160.1430.03318.97
5.4.150.1800.04319.22
5.4.140.1630.03716.34
5.4.130.1330.04316.39
5.4.120.1700.03316.39
5.4.110.1930.04316.36
5.4.100.0330.03316.51
5.4.90.0100.06316.58
5.4.80.0200.04016.27
5.4.70.1700.03316.52
5.4.60.1600.03716.38
5.4.50.1530.03316.48
5.4.40.1830.04316.14
5.4.30.1530.05016.24
5.4.20.1470.03716.43
5.4.10.1500.03716.46
5.4.00.1730.04015.86
5.3.290.1730.04014.63
5.3.280.1330.05314.57
5.3.270.1630.04714.70
5.3.260.0770.04314.50
5.3.250.0030.04314.75
5.3.240.0130.06314.61
5.3.230.1100.04014.57
5.3.220.1630.03314.66
5.3.210.1570.03314.54
5.3.200.1570.03714.71
5.3.190.1370.03714.58
5.3.180.1800.04314.56
5.3.170.1500.03714.55
5.3.160.1430.02714.53
5.3.150.1530.03714.61
5.3.140.1370.03714.57
5.3.130.1500.04014.46
5.3.120.1500.03714.55
5.3.110.1030.03014.69
5.3.100.0000.04314.07
5.3.90.0030.03713.92
5.3.80.1230.03314.10
5.3.70.1630.03714.04
5.3.60.1500.03013.92
5.3.50.1230.03014.09
5.3.40.1330.04313.86
5.3.30.1470.04013.81
5.3.20.1470.03313.77
5.3.10.1500.03013.88
5.3.00.1070.04713.55
5.2.170.1200.03011.38
5.2.160.1000.02711.07
5.2.150.1100.03311.16
5.2.140.1230.03011.22
5.2.130.1400.03311.03
5.2.120.0030.02711.20
5.2.110.0070.02311.10
5.2.100.0000.03011.21
5.2.90.1200.02711.03
5.2.80.1230.03311.10
5.2.70.1270.02711.12
5.2.60.1270.03310.93
5.2.50.0670.03311.16
5.2.40.0470.03010.91
5.2.30.0830.02710.90
5.2.20.0770.03011.01
5.2.10.0870.03310.77
5.2.00.1070.02310.60
5.1.60.1030.01710.07
5.1.50.1070.02310.17
5.1.40.0770.0209.96
5.1.30.1130.03010.34
5.1.20.1100.02310.41
5.1.10.0800.03010.20
5.1.00.1000.03710.00
5.0.50.0630.0278.56
5.0.40.0600.0208.31
5.0.30.0530.0538.15
5.0.20.0570.0338.09
5.0.10.0500.0278.05
5.0.00.0570.0308.17
4.4.90.0500.0177.89
4.4.80.0570.0107.89
4.4.70.0600.0237.89
4.4.60.0570.0207.89
4.4.50.0670.0137.89
4.4.40.0600.0407.89
4.4.30.0730.0177.89
4.4.20.0730.0307.89
4.4.10.0170.0137.89
4.4.00.0400.0277.89
4.3.110.0630.0207.89
4.3.100.0700.0237.89
4.3.90.0630.0207.89
4.3.80.0530.0277.89
4.3.70.0470.0177.89
4.3.60.0630.0177.89
4.3.50.0630.0137.89
4.3.40.0230.0237.89
4.3.30.0300.0137.89
4.3.20.0300.0307.89
4.3.10.0300.0207.89
4.3.00.0230.0177.89

preferences:
45.57 ms | 401 KiB | 5 Q