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)) { $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.0120.00318.32
8.3.50.0100.00821.21
8.3.40.0070.00718.65
8.3.30.0110.00418.59
8.3.20.0080.00018.60
8.3.10.0080.00020.48
8.3.00.0050.00323.57
8.2.180.0120.00318.29
8.2.170.0040.01122.96
8.2.160.0070.00720.35
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0070.00019.89
8.2.110.0100.00022.02
8.2.100.0070.00717.72
8.2.90.0040.00419.27
8.2.80.0090.00017.97
8.2.70.0100.00217.63
8.2.60.0060.00317.93
8.2.50.0050.00318.07
8.2.40.0000.00918.22
8.2.30.0060.00617.97
8.2.20.0030.00717.70
8.2.10.0000.00717.69
8.2.00.0050.00317.75
8.1.280.0110.00425.92
8.1.270.0090.00023.99
8.1.260.0000.00726.35
8.1.250.0060.00328.09
8.1.240.0060.00320.82
8.1.230.0060.00620.97
8.1.220.0050.00318.77
8.1.210.0040.00418.96
8.1.200.0030.00617.35
8.1.190.0040.00417.53
8.1.180.0040.00418.10
8.1.170.0050.00318.59
8.1.160.0000.00818.86
8.1.150.0070.00018.54
8.1.140.0070.00017.46
8.1.130.0030.00317.70
8.1.120.0000.00817.44
8.1.110.0050.00317.33
8.1.100.0000.00717.49
8.1.90.0000.00817.49
8.1.80.0030.00317.48
8.1.70.0000.00717.42
8.1.60.0050.00317.57
8.1.50.0060.00317.37
8.1.40.0000.00817.43
8.1.30.0040.00417.55
8.1.20.0000.00817.61
8.1.10.0000.00817.49
8.1.00.0000.00817.49
8.0.300.0050.00320.02
8.0.290.0040.00416.75
8.0.280.0070.00018.36
8.0.270.0030.00317.26
8.0.260.0030.00516.87
8.0.250.0070.00016.99
8.0.240.0100.00016.84
8.0.230.0070.00016.95
8.0.220.0000.00716.93
8.0.210.0000.00716.82
8.0.200.0020.00516.95
8.0.190.0000.00816.82
8.0.180.0040.00416.88
8.0.170.0060.00316.79
8.0.160.0070.00316.93
8.0.150.0000.00716.75
8.0.140.0050.00616.88
8.0.130.0050.00013.29
8.0.120.0050.00316.86
8.0.110.0000.00816.77
8.0.100.0080.00016.79
8.0.90.0070.00016.83
8.0.80.0080.00816.93
8.0.70.0040.00416.88
8.0.60.0040.00416.95
8.0.50.0000.00816.99
8.0.30.0150.00817.16
8.0.20.0080.01117.40
8.0.10.0040.00416.99
8.0.00.0080.01016.71
7.4.330.0030.00313.43
7.4.320.0060.00016.46
7.4.300.0030.00316.60
7.4.290.0000.00716.61
7.4.280.0000.00816.46
7.4.270.0070.00016.51
7.4.260.0000.00513.22
7.4.250.0040.00416.50
7.4.240.0000.00716.54
7.4.230.0000.00716.59
7.4.220.0060.01316.50
7.4.210.0090.00816.61
7.4.200.0000.00716.61
7.4.190.0070.00016.77
7.4.160.0030.01216.43
7.4.150.0090.00917.40
7.4.140.0080.00917.86
7.4.130.0110.00716.54
7.4.120.0140.00416.67
7.4.110.0110.00816.50
7.4.100.0120.00616.60
7.4.90.0120.00616.62
7.4.80.0120.00619.04
7.4.70.0130.01316.39
7.4.60.0030.01216.37
7.4.50.0030.00616.24
7.4.40.0070.01122.27
7.4.30.0070.01016.46
7.4.00.0100.00714.91
7.3.330.0050.00013.34
7.3.320.0000.00613.33
7.3.310.0000.00716.37
7.3.300.0070.00016.41
7.3.290.0070.00716.41
7.3.280.0130.00516.38
7.3.270.0060.01117.40
7.3.260.0120.00918.24
7.3.250.0070.01516.28
7.3.240.0160.00016.62
7.3.230.0140.00316.64
7.3.210.0040.01216.58
7.3.200.0120.00619.39
7.3.190.0090.01516.61
7.3.180.0080.00816.47
7.3.170.0080.00816.63
7.3.160.0050.01116.24
7.3.120.0140.00414.52
7.3.110.0100.01014.95
7.3.100.0070.00714.72
7.3.90.0120.00315.04
7.3.80.0070.00714.86
7.3.70.0040.01114.89
7.3.60.0060.01014.82
7.3.50.0080.00815.07
7.3.40.0090.00614.88
7.3.30.0060.00614.82
7.3.20.0030.01516.35
7.3.10.0080.00416.82
7.3.00.0090.00916.67
7.2.330.0090.00916.50
7.2.320.0060.01816.54
7.2.310.0100.00716.42
7.2.300.0060.01216.68
7.2.290.0160.00616.55
7.2.240.0100.01014.95
7.2.230.0030.01414.91
7.2.220.0030.01314.95
7.2.210.0040.01115.24
7.2.200.0070.00714.97
7.2.190.0090.00615.14
7.2.180.0110.00414.84
7.2.170.0000.01814.89
7.2.160.0100.00314.89
7.2.150.0090.00916.94
7.2.140.0040.00816.97
7.2.130.0070.01117.17
7.2.120.0070.00716.81
7.2.110.0030.01216.88
7.2.100.0090.00016.87
7.2.90.0090.00617.05
7.2.80.0000.01316.96
7.2.70.0030.01216.79
7.2.60.0030.00617.04
7.2.50.0030.01316.78
7.2.40.0090.00316.97
7.2.30.0030.01516.86
7.2.20.0070.00717.01
7.2.10.0030.01516.96
7.2.00.0070.00918.02
7.1.330.0060.01216.01
7.1.320.0100.00315.45
7.1.310.0070.00715.91
7.1.300.0080.00415.95
7.1.290.0040.01215.63
7.1.280.0040.00815.79
7.1.270.0070.00715.77
7.1.260.0070.00715.83
7.1.250.0030.01415.68
7.1.100.0030.00918.25
7.1.70.0060.00317.30
7.1.60.0180.00719.40
7.1.50.0040.01916.99
7.1.00.0030.07722.30
7.0.200.0040.00916.84
7.0.140.0130.06321.95
7.0.60.0030.04019.83
7.0.50.0070.05317.85
7.0.40.0100.07020.05
7.0.30.0530.06720.23
7.0.20.0400.07720.09
7.0.10.0100.06320.33
7.0.00.0100.05020.09
5.6.280.0100.07020.82
5.6.210.0200.06720.51
5.6.200.0030.04018.12
5.6.190.0130.07720.61
5.6.180.0330.07720.39
5.6.170.0300.06720.45
5.6.160.0100.07320.55
5.6.150.0100.08018.13
5.6.140.0030.08318.24
5.6.130.0070.08018.15
5.6.120.0070.06321.00
5.6.110.0070.08021.04
5.6.100.0100.06320.99
5.6.90.0130.07320.98
5.6.80.0130.07720.52
5.5.350.0230.02720.34
5.5.340.0130.07317.95
5.5.330.0130.03720.47
5.5.320.0100.07020.36
5.5.310.0270.05320.35
5.5.300.0030.04318.03
5.5.290.0070.04317.95
5.5.280.0100.06720.81
5.5.270.0130.03320.80
5.5.260.0170.07320.97
5.5.250.0130.07320.60
5.5.240.0200.07320.27
5.4.450.0300.08019.57
5.4.440.0370.07319.48
5.4.430.0430.03019.64
5.4.420.0270.06319.48
5.4.410.0370.06719.19
5.4.400.0470.06019.02
5.4.390.0270.05719.22
5.4.380.0370.07019.08
5.4.370.0370.04018.98
5.4.360.0300.04319.32
5.4.350.0400.06719.20
5.4.340.0400.04018.95
5.4.320.0400.04319.10
5.4.310.0430.03719.31
5.4.300.0400.06319.16
5.4.290.0300.06018.85
5.4.280.0400.07319.05
5.4.270.0400.06319.21
5.4.260.0370.03719.21
5.4.250.0370.05019.09
5.4.240.0470.05719.07
5.4.230.0400.06719.15
5.4.220.0400.07019.27
5.4.210.0470.06019.21
5.4.200.0400.04719.08
5.4.190.0330.04719.21
5.4.180.0270.04319.30
5.4.170.0330.04718.98
5.4.160.0400.06719.04
5.4.150.0400.06719.07
5.4.140.0370.04716.38
5.4.130.0500.05316.36
5.4.120.0430.06316.51
5.4.110.0370.06716.36
5.4.100.0400.06716.40
5.4.90.0330.06716.54
5.4.80.0430.03716.54
5.4.70.0430.03316.54
5.4.60.0270.07316.56
5.4.50.0330.04716.43
5.4.40.0430.03316.32
5.4.30.0300.05316.53
5.4.20.0270.04716.51
5.4.10.0270.06316.38
5.4.00.0200.03715.95
5.3.290.0400.04314.72
5.3.280.0370.07014.76
5.3.270.0400.06314.69
5.3.260.0400.04314.70
5.3.250.0300.04714.52
5.3.240.0430.05714.83
5.3.230.0400.07014.58
5.3.220.0370.07314.65
5.3.210.0330.06314.59
5.3.200.0300.06314.58
5.3.190.0400.07014.48
5.3.180.0370.07314.65
5.3.170.0470.03314.73
5.3.160.0370.03714.47
5.3.150.0330.07014.50
5.3.140.0330.07014.57
5.3.130.0270.07714.56
5.3.120.0230.05014.55
5.3.110.0270.08014.66
5.3.100.0270.06314.06
5.3.90.0370.06014.06
5.3.80.0330.05014.11
5.3.70.0400.04014.01
5.3.60.0430.06313.99
5.3.50.0300.05313.87
5.3.40.0430.05713.87
5.3.30.0370.07013.83
5.3.20.0370.06313.75
5.3.10.0430.06313.59
5.3.00.0300.07313.73
5.2.170.0330.05011.42
5.2.160.0330.03311.42
5.2.150.0400.05011.42
5.2.140.0270.06711.42
5.2.130.0300.06011.42
5.2.120.0270.05311.42
5.2.110.0270.05711.42
5.2.100.0300.05011.42
5.2.90.0400.05011.42
5.2.80.0300.05011.42
5.2.70.0300.05311.42
5.2.60.0270.05711.42
5.2.50.0300.05711.42
5.2.40.0200.03711.42
5.2.30.0200.03311.42
5.2.20.0230.06011.42
5.2.10.0330.05011.42
5.2.00.0300.03311.42
5.1.60.0200.02711.42
5.1.50.0270.04711.42
5.1.40.0230.03311.42
5.1.30.0230.03311.42
5.1.20.0170.05711.42
5.1.10.0170.03311.42
5.1.00.0130.02711.42
5.0.50.0130.02711.42
5.0.40.0170.01311.42
5.0.30.0130.06311.42
5.0.20.0100.03011.42
5.0.10.0130.04011.42
5.0.00.0200.03711.42
4.4.90.0230.01011.42
4.4.80.0100.02711.42
4.4.70.0100.02311.42
4.4.60.0130.03311.42
4.4.50.0130.03711.42
4.4.40.0100.04711.42
4.4.30.0130.03011.42
4.4.20.0100.03711.42
4.4.10.0170.01711.42
4.4.00.0070.03011.42
4.3.110.0170.01711.42
4.3.100.0130.03011.42
4.3.90.0100.01711.42
4.3.80.0100.05311.42
4.3.70.0200.03011.42
4.3.60.0070.03311.42
4.3.50.0100.03311.42
4.3.40.0100.04011.42
4.3.30.0070.03711.42
4.3.20.0030.03311.42
4.3.10.0070.03711.42
4.3.00.0100.03011.42

preferences:
44.35 ms | 401 KiB | 5 Q