3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_values_between($the_string, $starts_with, $ends_with) { if(strpos ($the_string , $starts_with)===false) return array(); $the_string = substr($the_string,strpos ($the_string , $starts_with)); $temp = array_filter(explode($starts_with, $the_string)); $result_array = array(); $inc = 0; foreach($temp as $a_start_match) { if (strlen($ends_with) <= strlen($a_start_match)) { $a_start_match = substr($a_start_match,0,strpos($a_start_match , $ends_with)); if(substr($a_start_match, -strlen($ends_with)) === $ends_with) { echo $a_start_match."\n"; $result_array[$inc]=$a_start_match; $inc++; } } } return $result_array; } $the_string = "some string here string_1ABCDEFGHstring2 some string here string_1IJKLMNOPQRSTstring2 some string here string_1UVWXYZstring2"; $start = "string_1"; $end = "string2"; $result = get_values_between($the_string,$start,$end); print_r($result);

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.0100.01016.63
8.3.50.0100.00722.05
8.3.40.0110.00418.71
8.3.30.0000.01718.96
8.3.20.0050.00520.21
8.3.10.0000.00723.59
8.3.00.0100.00020.68
8.2.180.0090.01316.38
8.2.170.0120.00322.96
8.2.160.0070.00722.12
8.2.150.0090.00024.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0000.00722.25
8.2.110.0090.00022.34
8.2.100.0140.00317.66
8.2.90.0000.00719.21
8.2.80.0060.00317.97
8.2.70.0080.00017.50
8.2.60.0030.00518.04
8.2.50.0080.00018.07
8.2.40.0050.00318.04
8.2.30.0040.00418.04
8.2.20.0040.00417.52
8.2.10.0080.00017.77
8.2.00.0060.00317.79
8.1.280.0110.00425.92
8.1.270.0070.00023.96
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00624.00
8.1.230.0070.00419.17
8.1.220.0050.00317.78
8.1.210.0040.00418.77
8.1.200.0030.00617.13
8.1.190.0040.00417.53
8.1.180.0000.00818.10
8.1.170.0030.00518.71
8.1.160.0080.00022.00
8.1.150.0070.00018.68
8.1.140.0030.00617.48
8.1.130.0040.00417.87
8.1.120.0000.00717.48
8.1.110.0040.00417.33
8.1.100.0000.00717.47
8.1.90.0070.00017.50
8.1.80.0030.00517.31
8.1.70.0000.00717.40
8.1.60.0000.00817.61
8.1.50.0040.00417.52
8.1.40.0030.00617.52
8.1.30.0040.00417.59
8.1.20.0030.00517.50
8.1.10.0000.00817.47
8.1.00.0040.00417.45
8.0.300.0040.00418.77
8.0.290.0070.00017.04
8.0.280.0030.00318.35
8.0.270.0000.00717.26
8.0.260.0030.00316.82
8.0.250.0070.00016.96
8.0.240.0050.00216.94
8.0.230.0070.00016.86
8.0.220.0030.00316.87
8.0.210.0070.00016.91
8.0.200.0000.00616.93
8.0.190.0040.00416.84
8.0.180.0040.00316.98
8.0.170.0090.00016.87
8.0.160.0000.00816.93
8.0.150.0000.00716.72
8.0.140.0000.00716.88
8.0.130.0000.00613.25
8.0.120.0050.00316.95
8.0.110.0040.00416.90
8.0.100.0000.00716.86
8.0.90.0050.00216.87
8.0.80.0130.00616.88
8.0.70.0040.00416.73
8.0.60.0040.00416.84
8.0.50.0070.00016.76
8.0.30.0100.00917.11
8.0.20.0140.00817.40
8.0.10.0050.00217.01
8.0.00.0120.00716.92
7.4.330.0000.00515.01
7.4.320.0040.00416.50
7.4.300.0060.00016.59
7.4.290.0030.00316.59
7.4.280.0040.00416.46
7.4.270.0040.00416.58
7.4.260.0030.00316.45
7.4.250.0000.00716.56
7.4.240.0020.00516.52
7.4.230.0000.00716.69
7.4.220.0120.01416.63
7.4.210.0110.00516.63
7.4.200.0020.00516.70
7.4.190.0040.00416.76
7.4.160.0110.00616.45
7.4.150.0110.00717.40
7.4.140.0130.00817.86
7.4.130.0110.00816.53
7.4.120.0090.01116.51
7.4.110.0090.01516.59
7.4.100.0190.00316.63
7.4.90.0130.01016.49
7.4.80.0160.00716.34
7.4.70.0070.01016.54
7.4.60.0130.00916.50
7.4.50.0040.00016.49
7.4.40.0040.01122.77
7.4.30.0110.00716.71
7.4.00.0030.01314.82
7.3.330.0050.00013.20
7.3.320.0050.00013.17
7.3.310.0030.00316.22
7.3.300.0000.00716.30
7.3.290.0070.00716.33
7.3.280.0120.00416.34
7.3.270.0100.00717.40
7.3.260.0030.01316.59
7.3.250.0160.00316.57
7.3.240.0070.01016.50
7.3.230.0130.00416.39
7.3.210.0140.00316.21
7.3.200.0110.00619.39
7.3.190.0070.01016.63
7.3.180.0060.01016.25
7.3.170.0080.00916.67
7.3.160.0100.00516.61
7.3.120.0130.00514.91
7.3.110.0100.00614.77
7.3.100.0110.00414.86
7.3.90.0040.00814.93
7.3.80.0030.01014.58
7.3.70.0120.00414.86
7.3.60.0110.00414.80
7.3.50.0090.00314.80
7.3.40.0110.00714.84
7.3.30.0060.00614.77
7.3.20.0100.01016.58
7.3.10.0060.00816.56
7.3.00.0030.00816.58
7.2.330.0100.00716.46
7.2.320.0110.00816.73
7.2.310.0100.00716.73
7.2.300.0090.00616.39
7.2.290.0130.00316.88
7.2.250.0000.01615.15
7.2.240.0030.01714.91
7.2.230.0040.01115.24
7.2.220.0030.00715.02
7.2.210.0090.00615.05
7.2.200.0070.00715.12
7.2.190.0070.00714.71
7.2.180.0070.00315.23
7.2.170.0040.01514.89
7.2.130.0090.00916.89
7.2.120.0080.00416.83
7.2.110.0090.00316.41
7.2.100.0030.01016.98
7.2.90.0070.01016.71
7.2.80.0100.00716.97
7.2.70.0060.00616.80
7.2.60.0100.00316.92
7.2.50.0070.00916.76
7.2.40.0000.01416.92
7.2.30.0140.00317.02
7.2.20.0100.00716.77
7.2.10.0070.00716.72
7.2.00.0030.01118.23
7.1.330.0030.01315.99
7.1.320.0070.00315.57
7.1.310.0120.00315.84
7.1.300.0040.00715.51
7.1.290.0090.00315.82
7.1.280.0040.01115.54
7.1.270.0090.00615.65
7.1.260.0060.00615.79
7.1.250.0100.00315.71
7.1.200.0060.00615.40
7.1.100.0000.01218.39
7.1.70.0060.00617.34
7.1.60.0070.01819.27
7.1.50.0030.01416.76
7.1.00.0030.07722.54
7.0.200.0000.00916.62
7.0.140.0000.07721.99
7.0.70.0030.08721.68
7.0.60.0030.08321.66
7.0.50.0100.06322.09
7.0.40.0170.08320.13
7.0.30.0100.06320.14
7.0.20.0130.07020.09
7.0.10.0130.07320.06
7.0.00.0170.07720.14
5.6.280.0000.07721.11
5.6.220.0000.08020.66
5.6.210.0030.08320.68
5.6.200.0130.08021.15
5.6.190.0170.07321.01
5.6.180.0070.06321.04
5.6.170.0000.07720.97
5.6.160.0030.08721.12
5.6.150.0070.08320.97
5.6.140.0100.08021.18
5.6.130.0100.08320.97
5.6.120.0030.09321.09
5.6.110.0030.07321.04
5.6.100.0030.08321.10
5.6.90.0130.05721.16
5.6.80.0100.05720.48
5.6.70.0000.05020.49
5.6.60.0100.08020.40
5.6.50.0000.08320.58
5.6.40.0030.04720.37
5.6.30.0100.03720.47
5.6.20.0070.07720.53
5.6.10.0000.06720.39
5.6.00.0100.08020.28
5.5.360.0070.08720.51
5.5.350.0030.05320.34
5.5.340.0100.07720.81
5.5.330.0030.05720.75
5.5.320.0170.07320.94
5.5.310.0070.08020.93
5.5.300.0030.08320.89
5.5.290.0070.08320.79
5.5.280.0070.08320.80
5.5.270.0030.09020.89
5.5.260.0070.07720.79
5.5.250.0130.07020.59
5.5.240.0030.05020.23
5.5.230.0030.06020.27
5.5.220.0030.05720.27
5.5.210.0100.07320.12
5.5.200.0030.07720.24
5.5.190.0070.04320.12
5.5.180.0000.08320.25
5.5.160.0070.07720.25
5.5.150.0130.07720.17
5.5.140.0000.04720.08
5.5.130.0070.08020.27
5.5.120.0070.04020.27
5.5.110.0070.07720.11
5.5.100.0000.08320.15
5.5.90.0070.07719.98
5.5.80.0100.06720.08
5.5.70.0070.07019.98
5.5.60.0130.06720.07
5.5.50.0000.07720.15
5.5.40.0000.08020.07
5.5.30.0070.04320.07
5.5.20.0000.06020.10
5.5.10.0130.07320.11
5.5.00.0130.07020.04
5.4.450.0100.06719.49
5.4.440.0130.07019.35
5.4.430.0070.08019.45
5.4.420.0100.07319.20
5.4.410.0070.05719.22
5.4.400.0130.06719.04
5.4.390.0070.08019.04
5.4.380.0070.07719.03
5.4.370.0030.05019.21
5.4.360.0130.07719.12
5.4.350.0000.08319.04
5.4.340.0030.06318.84
5.4.320.0070.08019.13
5.4.310.0070.05319.16
5.4.300.0070.07719.03
5.4.290.0030.05718.87
5.4.280.0030.08319.18
5.4.270.0170.07318.98
5.4.260.0100.06318.90
5.4.250.0030.06719.11
5.4.240.0070.04718.94
5.4.230.0070.07719.24
5.4.220.0070.08019.02
5.4.210.0170.06319.04
5.4.200.0100.07018.94
5.4.190.0030.06018.89
5.4.180.0070.04019.08
5.4.170.0030.08019.22
5.4.160.0070.04019.19
5.4.150.0070.05719.03
5.4.140.0030.04016.30
5.4.130.0030.03716.32
5.4.120.0100.03016.14
5.4.110.0070.04716.46
5.4.100.0030.07316.32
5.4.90.0030.06016.33
5.4.80.0070.05316.48
5.4.70.0070.03316.39
5.4.60.0030.04016.48
5.4.50.0070.06716.44
5.4.40.0000.05316.39
5.4.30.0000.05716.40
5.4.20.0170.06016.48
5.4.10.0000.09016.32
5.4.00.0070.05015.87
5.3.290.0030.07714.68
5.3.280.0000.05014.72
5.3.270.0030.05314.75
5.3.260.0070.05014.54
5.3.250.0070.05014.59
5.3.240.0070.04714.64
5.3.230.0070.03714.74
5.3.220.0070.03314.50
5.3.210.0070.07314.47
5.3.200.0070.04714.63
5.3.190.0030.03714.63
5.3.180.0000.07714.69
5.3.170.0000.04314.63
5.3.160.0000.04014.71
5.3.150.0000.04314.69
5.3.140.0100.07314.57
5.3.130.0070.04714.68
5.3.120.0070.07314.48
5.3.110.0070.07714.65
5.3.100.0070.03714.09
5.3.90.0030.08014.04
5.3.80.0030.05314.04
5.3.70.0030.07314.04
5.3.60.0000.05313.90
5.3.50.0000.03714.06
5.3.40.0000.05014.05
5.3.30.0030.07014.03
5.3.20.0000.04013.80
5.3.10.0030.03713.64
5.3.00.0030.07313.71
5.2.170.0000.04011.21
5.2.160.0000.05311.26
5.2.150.0000.04711.17
5.2.140.0000.03711.21
5.2.130.0070.03011.01
5.2.120.0030.02711.18
5.2.110.0000.03011.11
5.2.100.0030.06311.13
5.2.90.0030.06311.27
5.2.80.0070.06010.98
5.2.70.0030.06011.11
5.2.60.0100.05711.07
5.2.50.0030.05710.95
5.2.40.0130.05710.91
5.2.30.0030.06710.87
5.2.20.0070.06010.92
5.2.10.0030.06310.73
5.2.00.0000.06310.68
5.1.60.0000.05710.42
5.1.50.0000.05310.42
5.1.40.0070.04710.42
5.1.30.0070.05710.42
5.1.20.0070.05010.42
5.1.10.0030.05310.42
5.1.00.0000.05310.42
5.0.50.0000.05010.42
5.0.40.0000.03710.42
5.0.30.0000.05710.42
5.0.20.0070.03310.42
5.0.10.0000.05010.42
5.0.00.0000.05010.42
4.4.90.0030.03310.42
4.4.80.0030.03710.42
4.4.70.0000.03710.42
4.4.60.0030.03010.42
4.4.50.0030.03310.42
4.4.40.0000.05310.42
4.4.30.0030.03310.42
4.4.20.0000.04010.42
4.4.10.0030.03310.42
4.4.00.0000.04710.42
4.3.110.0030.03310.42
4.3.100.0000.03710.42
4.3.90.0030.02010.42
4.3.80.0000.05710.42
4.3.70.0000.03710.42
4.3.60.0000.03710.42
4.3.50.0070.03010.42
4.3.40.0000.05310.42
4.3.30.0000.03310.42
4.3.20.0200.01310.42
4.3.10.0030.03710.42
4.3.00.0030.03310.42

preferences:
41.72 ms | 401 KiB | 5 Q