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)); echo $the_string; $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_1UVWstring2XYZ"; $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.00718.18
8.3.50.0160.00721.98
8.3.40.0140.00718.45
8.3.30.0070.00719.11
8.3.20.0030.00520.29
8.3.10.0080.01222.13
8.3.00.0130.00022.39
8.2.180.0150.00016.75
8.2.170.0100.01022.96
8.2.160.0140.00719.20
8.2.150.0090.00924.18
8.2.140.0100.00624.66
8.2.130.0130.00626.16
8.2.120.0110.00719.48
8.2.110.0030.00622.03
8.2.100.0050.00519.57
8.2.90.0080.00019.26
8.2.80.0030.00517.97
8.2.70.0060.00317.50
8.2.60.0030.00517.80
8.2.50.0040.00418.07
8.2.40.0040.00419.95
8.2.30.0030.00518.16
8.2.20.0030.00517.66
8.2.10.0000.00817.75
8.2.00.0040.00417.79
8.1.280.0090.00625.92
8.1.270.0080.00022.06
8.1.260.0150.00326.35
8.1.250.0090.00928.09
8.1.240.0060.00323.86
8.1.230.0100.00018.73
8.1.220.0080.00017.79
8.1.210.0030.00618.77
8.1.200.0080.00317.23
8.1.190.0080.00017.51
8.1.180.0040.00418.74
8.1.170.0030.00518.51
8.1.160.0000.00722.14
8.1.150.0080.00018.64
8.1.140.0040.00417.36
8.1.130.0000.00717.83
8.1.120.0030.00317.32
8.1.110.0020.00517.36
8.1.100.0050.00217.39
8.1.90.0050.00217.46
8.1.80.0000.00717.46
8.1.70.0000.00817.38
8.1.60.0030.00517.52
8.1.50.0020.00517.42
8.1.40.0040.00417.58
8.1.30.0040.00417.65
8.1.20.0030.00617.66
8.1.10.0040.00417.50
8.1.00.0080.00017.30
8.0.300.0030.00518.77
8.0.290.0070.00017.05
8.0.280.0000.00718.35
8.0.270.0050.00217.32
8.0.260.0000.00616.82
8.0.250.0000.00716.96
8.0.240.0090.00016.96
8.0.230.0000.00716.91
8.0.220.0070.00016.96
8.0.210.0040.00416.78
8.0.200.0040.00416.98
8.0.190.0040.00416.95
8.0.180.0040.00416.89
8.0.170.0000.00816.92
8.0.160.0000.00716.71
8.0.150.0090.00016.81
8.0.140.0000.00816.86
8.0.130.0050.00013.33
8.0.120.0000.00816.75
8.0.110.0040.00416.83
8.0.100.0040.00416.78
8.0.90.0000.00716.84
8.0.80.0060.01116.82
8.0.70.0060.00316.78
8.0.60.0070.00016.73
8.0.50.0040.00416.74
8.0.30.0110.00817.27
8.0.20.0110.00817.40
8.0.10.0050.00316.92
8.0.00.0130.01116.80
7.4.330.0030.00315.00
7.4.320.0060.00016.61
7.4.300.0030.00316.48
7.4.290.0070.00016.56
7.4.280.0000.00616.63
7.4.270.0070.00016.53
7.4.260.0000.00816.57
7.4.250.0040.00416.46
7.4.240.0060.00116.60
7.4.230.0030.00316.69
7.4.220.0070.01116.59
7.4.210.0070.00816.45
7.4.200.0000.00716.58
7.4.190.0050.00216.70
7.4.160.0090.00616.66
7.4.150.0110.00717.40
7.4.140.0110.00717.86
7.4.130.0080.01016.38
7.4.120.0140.00616.41
7.4.110.0080.01116.49
7.4.100.0130.00416.54
7.4.90.0100.00716.62
7.4.80.0110.00819.39
7.4.70.0150.00916.33
7.4.60.0100.00716.34
7.4.50.0050.00316.28
7.4.40.0060.00922.77
7.4.30.0060.01016.63
7.4.00.0040.01114.90
7.3.330.0030.00313.20
7.3.320.0050.00013.23
7.3.310.0040.00416.40
7.3.300.0000.00716.38
7.3.290.0090.01216.39
7.3.280.0050.01016.32
7.3.270.0140.01017.40
7.3.260.0130.00316.56
7.3.250.0090.00816.45
7.3.240.0100.00716.49
7.3.230.0130.00816.61
7.3.210.0090.00816.36
7.3.200.0060.01019.39
7.3.190.0070.01016.73
7.3.180.0000.01716.38
7.3.170.0000.02016.54
7.3.160.0090.00616.40
7.3.120.0080.00814.53
7.2.330.0060.01216.60
7.2.320.0120.00616.59
7.2.310.0110.01416.70
7.2.300.0080.00816.50
7.2.290.0080.00916.75
7.2.00.0000.01219.55
7.1.100.0050.00518.06
7.1.70.0030.00517.20
7.1.60.0090.01519.82
7.1.50.0100.00717.05
7.1.00.0100.07022.30
7.0.200.0030.00716.69
7.0.140.0070.07022.07
7.0.60.0100.07720.02
7.0.50.0130.07717.88
7.0.40.0030.04720.27
7.0.30.0170.06720.13
7.0.20.0300.05320.23
7.0.10.0070.07320.30
7.0.00.0030.05320.11
5.6.280.0000.07721.10
5.6.210.0070.06720.48
5.6.200.0170.07718.29
5.6.190.0270.06720.57
5.6.180.0300.04720.58
5.6.170.0300.04320.56
5.6.160.0000.09020.61
5.6.150.0070.05718.28
5.6.140.0000.08318.18
5.6.130.0100.07318.14
5.6.120.0170.07721.01
5.6.110.0070.08021.06
5.6.100.0070.08721.05
5.6.90.0100.05721.12
5.6.80.0130.07320.36
5.5.350.3670.04020.42
5.5.340.0000.04317.99
5.5.330.0100.05020.57
5.5.320.0300.06320.26
5.5.310.0330.07020.34
5.5.300.0000.08717.94
5.5.290.0000.04317.96
5.5.280.0130.07720.78
5.5.270.0000.04720.73
5.5.260.0100.05320.98
5.5.250.0000.04720.67
5.5.240.0070.07320.38
5.4.450.0200.04019.55
5.4.440.0230.06719.48
5.4.430.0270.06719.27
5.4.420.0330.07019.30
5.4.410.0270.04319.18
5.4.400.0270.04718.86
5.4.390.0300.04719.24
5.4.380.0300.06318.88
5.4.370.0300.06718.89
5.4.360.0170.08319.09
5.4.350.0230.07718.95
5.4.340.0270.06018.87
5.4.320.0270.07719.00
5.4.310.0170.04719.09
5.4.300.0200.08019.16
5.4.290.0270.05719.29
5.4.280.0130.08019.15
5.4.270.0270.05719.21
5.4.260.0100.06318.85
5.4.250.0200.07719.15
5.4.240.0230.04019.18
5.4.230.0300.07319.08
5.4.220.0200.04319.08
5.4.210.0230.03719.13
5.4.200.0270.06719.21
5.4.190.0200.05019.23
5.4.180.0170.03718.86
5.4.170.0200.07319.13
5.4.160.0330.06718.93
5.4.150.0300.07018.92
5.4.140.0370.03316.36
5.4.130.0270.06316.33
5.4.120.0230.04716.29
5.4.110.0200.07316.28
5.4.100.0300.05316.55
5.4.90.0170.04016.35
5.4.80.0300.06716.55
5.4.70.0230.04316.44
5.4.60.0300.06316.39
5.4.50.0200.07016.38
5.4.40.0330.05716.32
5.4.30.0230.03316.50
5.4.20.0370.05016.48
5.4.10.0200.07316.50
5.4.00.0230.05015.95
5.3.290.0270.04714.75
5.3.280.0230.07014.68
5.3.270.0330.06714.70
5.3.260.0230.03714.59
5.3.250.0330.05714.52
5.3.240.0230.07314.69
5.3.230.0200.05014.66
5.3.220.0300.04314.66
5.3.210.0170.04014.48
5.3.200.0270.05714.65
5.3.190.0200.05014.48
5.3.180.0200.04314.64
5.3.170.0270.04314.48
5.3.160.0300.06314.61
5.3.150.0270.05014.47
5.3.140.0170.04714.66
5.3.130.0170.04014.46
5.3.120.0130.04314.65
5.3.110.0330.03314.54
5.3.100.0200.04713.95
5.3.90.0270.04314.11
5.3.80.0170.04013.93
5.3.70.0130.04013.95
5.3.60.0270.02713.94
5.3.50.0170.03714.05
5.3.40.0200.05714.04
5.3.30.0200.03313.89
5.3.20.0170.03713.63
5.3.10.0230.07313.67
5.3.00.0370.03713.59
5.2.170.0130.05711.78
5.2.160.0130.03311.78
5.2.150.0100.04011.78
5.2.140.0170.03711.78
5.2.130.0200.05711.78
5.2.120.0170.05711.78
5.2.110.0170.06011.78
5.2.100.0170.06311.78
5.2.90.0200.03311.78
5.2.80.0070.03711.78
5.2.70.0100.03311.78
5.2.60.0170.05311.78
5.2.50.0170.04011.78
5.2.40.0230.05011.78
5.2.30.0100.03311.78
5.2.20.0130.03711.78
5.2.10.0130.06011.78
5.2.00.0130.04711.78
5.1.60.0130.02711.78
5.1.50.0170.04311.78
5.1.40.0070.03011.78
5.1.30.0170.05011.78
5.1.20.0270.04711.78
5.1.10.0170.04311.78
5.1.00.0130.03311.78
5.0.50.0100.02011.78
5.0.40.0030.02311.78
5.0.30.0130.06711.78
5.0.20.0070.04711.78
5.0.10.0130.04011.78
5.0.00.0070.04711.78
4.4.90.0100.01311.78
4.4.80.0130.01311.78
4.4.70.0070.03711.78
4.4.60.0000.03311.78
4.4.50.0030.04011.78
4.4.40.0070.02311.78
4.4.30.0100.01311.78
4.4.20.0100.03311.78
4.4.10.0100.02711.78
4.4.00.0070.02711.78
4.3.110.0130.02311.78
4.3.100.0100.02311.78
4.3.90.0100.02711.78
4.3.80.0130.05011.78
4.3.70.0070.01711.78
4.3.60.0030.02011.78
4.3.50.0170.02311.78
4.3.40.0130.04711.78
4.3.30.0100.03311.78
4.3.20.0030.04011.78
4.3.10.0100.03311.78
4.3.00.0070.02711.78

preferences:
65.22 ms | 401 KiB | 5 Q