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\n\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,strpos($a_start_match , $ends_with)); echo $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_1ABCDEFGHstring2 some string here string_1IJKLMNOPQRSTstring2 some string here string_1UVWXYZstring2"; $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.40.0080.00618.71
8.3.30.0070.01318.42
8.3.20.0040.00418.65
8.3.10.0040.00420.36
8.3.00.0060.00323.63
8.2.170.0130.00722.96
8.2.160.0110.00422.08
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.51
8.2.110.0030.00622.13
8.2.100.0040.00717.78
8.2.90.0080.00019.23
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0080.00318.16
8.2.30.0040.00419.91
8.2.20.0030.00517.53
8.2.10.0040.00417.84
8.2.00.0050.00217.74
8.1.270.0030.00623.99
8.1.260.0110.00426.35
8.1.250.0080.00028.09
8.1.240.0000.01022.46
8.1.230.0030.01021.03
8.1.220.0000.00818.77
8.1.210.0030.00618.90
8.1.200.0040.00717.25
8.1.190.0040.00417.40
8.1.180.0040.00418.10
8.1.170.0050.00318.75
8.1.160.0070.00018.83
8.1.150.0000.00818.74
8.1.140.0040.00417.38
8.1.130.0030.00317.83
8.1.120.0030.00417.46
8.1.110.0040.00417.38
8.1.100.0040.00417.45
8.1.90.0030.00317.47
8.1.80.0000.00717.46
8.1.70.0030.00317.47
8.1.60.0090.00017.49
8.1.50.0040.00417.35
8.1.40.0030.00617.57
8.1.30.0060.00317.68
8.1.20.0030.00617.58
8.1.10.0040.00417.44
8.1.00.0040.00417.43
8.0.300.0080.00020.02
8.0.290.0000.00716.63
8.0.280.0030.00318.41
8.0.270.0070.00017.29
8.0.260.0030.00316.82
8.0.250.0000.00816.97
8.0.240.0040.00416.85
8.0.230.0050.00316.82
8.0.220.0000.00716.83
8.0.210.0040.00416.87
8.0.200.0030.00316.94
8.0.190.0060.00316.85
8.0.180.0030.00716.97
8.0.170.0000.00916.93
8.0.160.0000.00816.94
8.0.150.0000.00816.80
8.0.140.0060.00316.74
8.0.130.0000.00613.32
8.0.120.0030.00516.75
8.0.110.0000.00716.71
8.0.100.0050.00316.79
8.0.90.0000.00916.72
8.0.80.0060.00916.87
8.0.70.0070.00016.76
8.0.60.0040.00416.90
8.0.50.0040.00416.97
8.0.30.0120.00617.04
8.0.20.0140.00517.40
8.0.10.0050.00217.06
8.0.00.0060.01216.85
7.4.330.0030.00314.69
7.4.320.0000.00716.48
7.4.300.0030.00316.49
7.4.290.0060.00016.60
7.4.280.0000.00716.43
7.4.270.0070.00016.60
7.4.260.0030.00313.22
7.4.250.0040.00416.56
7.4.240.0000.00716.46
7.4.230.0000.00716.59
7.4.220.0040.01216.54
7.4.210.0100.00516.58
7.4.200.0030.00516.35
7.4.190.0000.00716.48
7.4.160.0130.00316.61
7.4.150.0100.00717.40
7.4.140.0090.00917.86
7.4.130.0080.01116.52
7.4.120.0050.01216.46
7.4.110.0120.00616.48
7.4.100.0060.01316.50
7.4.90.0120.00416.63
7.4.80.0090.00919.04
7.4.70.0120.00616.37
7.4.60.0090.01216.49
7.4.50.0050.00516.44
7.4.40.0070.00722.27
7.4.30.0090.00616.49
7.4.10.0150.00314.88
7.4.00.0120.00315.11
7.3.330.0000.00513.36
7.3.320.0000.00513.32
7.3.310.0070.00016.41
7.3.300.0030.00316.19
7.3.290.0070.00716.33
7.3.280.0080.00616.34
7.3.270.0150.00817.40
7.3.260.0090.00918.24
7.3.250.0130.00716.41
7.3.240.0030.01316.42
7.3.230.0120.00816.39
7.3.210.0000.01716.37
7.3.200.0090.00719.39
7.3.190.0110.00716.45
7.3.180.0030.01216.36
7.3.170.0070.01316.52
7.3.160.0100.00716.41
7.3.130.0080.00315.17
7.3.120.0070.01014.69
7.3.110.0070.01015.01
7.3.100.0050.01014.79
7.3.90.0060.01015.10
7.3.80.0020.00915.00
7.3.70.0070.00914.91
7.3.60.0090.00314.62
7.3.50.0040.01114.74
7.3.40.0060.01014.83
7.3.30.0050.00714.69
7.3.20.0090.00616.57
7.3.10.0040.01116.81
7.3.00.0050.00616.64
7.2.330.0090.00916.66
7.2.320.0120.01216.80
7.2.310.0100.01016.59
7.2.300.0080.00816.89
7.2.290.0120.00916.72
7.2.260.0110.00715.30
7.2.250.0070.01315.09
7.2.240.0130.00515.12
7.2.230.0030.01115.03
7.2.220.0020.01314.87
7.2.210.0050.00815.03
7.2.200.0080.00614.93
7.2.190.0080.00615.03
7.2.180.0040.00914.95
7.2.170.0020.01414.79
7.2.160.0070.01015.20
7.2.150.0000.01517.08
7.2.140.0100.00716.95
7.2.130.0060.00616.95
7.2.120.0030.00917.00
7.2.110.0180.00416.83
7.2.100.0030.00716.92
7.2.90.0030.01516.84
7.2.80.0130.00316.71
7.2.70.0000.01416.98
7.2.60.0060.00616.91
7.2.50.0060.00617.03
7.2.40.0060.00916.86
7.2.30.0070.00717.12
7.2.20.0040.00717.09
7.2.10.0000.01017.11
7.2.00.0080.00718.27
7.1.330.0070.00715.95
7.1.320.0030.01515.68
7.1.310.0100.00515.83
7.1.300.0060.00615.75
7.1.290.0090.00715.76
7.1.280.0030.00815.86
7.1.270.0030.00715.79
7.1.260.0040.01215.75
7.1.250.0060.00615.79
7.1.240.0070.01015.76
7.1.230.0110.00415.88
7.1.220.0060.00615.68
7.1.210.0060.00315.91
7.1.200.0070.01115.80
7.1.190.0030.01015.94
7.1.180.0030.00815.87
7.1.170.0080.00815.66
7.1.160.0030.00815.68
7.1.150.0070.00415.55
7.1.140.0080.00415.79
7.1.130.0090.00615.81
7.1.120.0100.00715.63
7.1.110.0030.00716.04
7.1.100.0030.00916.88
7.1.90.0090.00615.61
7.1.80.0030.00915.98
7.1.70.0000.01416.47
7.1.60.0090.01017.59
7.1.50.0070.01216.35
7.1.40.0110.00315.71
7.1.30.0040.01115.59
7.1.20.0000.01015.52
7.1.10.0070.00415.77
7.1.00.0050.03319.13
7.0.330.0030.01015.23
7.0.320.0030.01015.39
7.0.310.0070.01015.20
7.0.300.0000.01315.45
7.0.290.0100.00315.50
7.0.280.0050.00315.37
7.0.270.0070.00715.11
7.0.260.0060.00315.57
7.0.250.0070.00415.61
7.0.240.0100.00315.36
7.0.230.0000.00915.30
7.0.220.0030.00515.48
7.0.210.0060.00615.23
7.0.200.0030.00716.19
7.0.190.0070.00715.57
7.0.180.0060.00615.57
7.0.170.0040.00715.15
7.0.160.0100.00315.37
7.0.150.0040.01415.52
7.0.140.0030.04318.71
7.0.130.0000.01115.51
7.0.120.0030.01015.57
7.0.110.0040.00815.39
7.0.100.0070.00415.43
7.0.90.0030.00615.41
7.0.80.0000.00915.38
7.0.70.0030.01015.34
7.0.60.0030.02817.75
7.0.50.0050.04716.79
7.0.40.0120.02616.77
7.0.30.0080.02916.84
7.0.20.0130.02816.77
7.0.10.0120.02516.82
7.0.00.0100.03016.85
5.6.400.0040.00814.33
5.6.390.0030.01014.38
5.6.380.0110.00414.27
5.6.370.0100.00314.32
5.6.360.0030.00914.13
5.6.350.0090.00614.35
5.6.340.0040.00714.14
5.6.330.0000.01514.21
5.6.320.0100.00014.47
5.6.310.0030.01014.70
5.6.300.0140.00414.04
5.6.290.0100.00714.66
5.6.280.0080.03617.64
5.6.270.0000.01414.60
5.6.260.0000.01414.43
5.6.250.0110.00414.44
5.6.240.0120.00414.32
5.6.230.0070.00714.41
5.6.220.0030.00914.29
5.6.210.0050.03017.35
5.6.200.0120.04216.16
5.6.190.0170.04317.45
5.6.180.0120.02717.42
5.6.170.0050.03117.51
5.6.160.0070.02417.43
5.6.150.0120.02517.18
5.6.140.0120.02217.41
5.6.130.0130.02417.24
5.6.120.0080.02717.51
5.6.110.0030.03017.39
5.6.100.0150.02317.08
5.6.90.0150.02517.46
5.6.80.0080.02617.06
5.6.70.0120.02016.93
5.6.60.0100.02317.05
5.6.50.0070.02717.13
5.6.40.0080.02516.88
5.6.30.0120.02717.03
5.6.20.0100.02316.90
5.6.10.0160.01716.84
5.6.00.0100.03917.00
5.5.380.0030.01214.27
5.5.370.0070.01014.51
5.5.360.0000.01314.47
5.5.350.0180.04217.29
5.5.340.0030.04516.01
5.5.330.0160.04317.10
5.5.320.0100.02317.30
5.5.310.0050.02917.34
5.5.300.0110.02317.30
5.5.290.0130.02217.17
5.5.280.0070.02617.16
5.5.270.0130.02517.30
5.5.260.0130.02317.09
5.5.250.0070.02616.89
5.5.240.0090.02416.79
5.5.230.0130.02116.84
5.5.220.0110.03016.81
5.5.210.0100.02317.07
5.5.200.0070.02316.84
5.5.190.0070.02716.96
5.5.180.0080.02317.01
5.5.170.0040.00814.12
5.5.160.0110.02916.83
5.5.150.0190.03816.85
5.5.140.0150.04716.75
5.5.130.0100.03216.62
5.5.120.0180.04116.66
5.5.110.0180.03616.87
5.5.100.0120.04516.78
5.5.90.0150.02616.73
5.5.80.0130.04016.75
5.5.70.0150.04016.65
5.5.60.0180.04016.80
5.5.50.0140.03916.81
5.5.40.0170.03916.64
5.5.30.0120.04116.73
5.5.20.0180.02316.60
5.5.10.0130.03516.67
5.5.00.0190.03916.93
5.4.450.0100.02215.88
5.4.440.0070.02715.73
5.4.430.0100.03515.90
5.4.420.0080.02915.77
5.4.410.0080.02015.80
5.4.400.0100.02115.77
5.4.390.0120.03015.63
5.4.380.0120.01815.57
5.4.370.0100.01815.75
5.4.360.0120.02515.58
5.4.350.0060.02315.72
5.4.340.0080.02015.57
5.4.330.0000.01112.29
5.4.320.0180.02515.75
5.4.310.0120.03015.75
5.4.300.0150.03715.72
5.4.290.0130.03815.64
5.4.280.0100.02315.58
5.4.270.0120.03615.58
5.4.260.0140.03915.68
5.4.250.0150.03315.60
5.4.240.0180.03215.62
5.4.230.0180.02615.78
5.4.220.0130.04115.58
5.4.210.0220.03715.58
5.4.200.0100.04015.77
5.4.190.0170.03515.65
5.4.180.0170.02315.58
5.4.170.0170.02515.76
5.4.160.0130.04215.78
5.4.150.0150.03815.71
5.4.140.0130.03814.41
5.4.130.0140.03514.35
5.4.120.0170.02714.36
5.4.110.0080.02714.48
5.4.100.0120.03814.38
5.4.90.0170.03214.29
5.4.80.0100.04014.30
5.4.70.0150.02714.30
5.4.60.0160.03014.35
5.4.50.0080.03614.27
5.4.40.0230.02514.28
5.4.30.0150.02014.32
5.4.20.0100.02814.27
5.4.10.0150.03514.29
5.4.00.0100.03314.07
5.3.290.0110.03413.49
5.3.280.0150.02913.47
5.3.270.0170.02213.39
5.3.260.0100.04513.53
5.3.250.0130.03813.48
5.3.240.0160.03413.52
5.3.230.0130.03013.45
5.3.220.0120.03913.44
5.3.210.0140.03913.43
5.3.200.0220.04013.50
5.3.190.0150.03313.39
5.3.180.0120.02313.43
5.3.170.0130.04013.43
5.3.160.0170.03213.45
5.3.150.0120.03813.44
5.3.140.0070.03413.42
5.3.130.0150.02513.43
5.3.120.0200.02013.43
5.3.110.0120.03813.44
5.3.100.0120.04013.16
5.3.90.0170.04013.15
5.3.80.0150.03513.15
5.3.70.0120.03913.13
5.3.60.0060.04313.13
5.3.50.0080.04013.12
5.3.40.0150.03713.14
5.3.30.0120.04013.12
5.3.20.0170.02813.03
5.3.10.0150.03213.04
5.3.00.0120.03113.04
5.2.170.0170.05012.64
5.2.160.0230.03012.64
5.2.150.0200.05712.64
5.2.140.0170.03712.64
5.2.130.0270.05012.64
5.2.120.0100.06712.64
5.2.110.0130.04012.64
5.2.100.0230.03312.64
5.2.90.0130.06712.64
5.2.80.0170.04312.64
5.2.70.0170.04312.64
5.2.60.0200.06012.64
5.2.50.0300.04712.64
5.2.40.0230.05312.64
5.2.30.0130.06312.64
5.2.20.0100.06712.64
5.2.10.0130.03712.64
5.2.00.0200.03712.64
5.1.60.0170.04712.64
5.1.50.0170.05012.64
5.1.40.0170.02712.64
5.1.30.0130.02712.64
5.1.20.0130.03012.64
5.1.10.0170.05712.64
5.1.00.0130.05012.64
5.0.50.0070.02712.64
5.0.40.0100.03012.64
5.0.30.0070.06312.64
5.0.20.0100.04012.64
5.0.10.0030.03712.64
5.0.00.0100.04712.64
4.4.90.0170.02712.64
4.4.80.0030.04012.64
4.4.70.0100.03712.64
4.4.60.0100.02712.64
4.4.50.0070.03012.64
4.4.40.0030.03012.64
4.4.30.0100.01712.64
4.4.20.0100.02312.64
4.4.10.0070.03712.64
4.4.00.0100.04312.64
4.3.110.0100.02012.64
4.3.100.0100.03312.64
4.3.90.0130.03012.64
4.3.80.0070.03712.64
4.3.70.0070.03012.64
4.3.60.0030.03712.64
4.3.50.0100.03012.64
4.3.40.0070.05712.64
4.3.30.0030.02012.64
4.3.20.0130.03012.64
4.3.10.0030.03712.64
4.3.00.0030.02012.64

preferences:
45.2 ms | 400 KiB | 5 Q