3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Do you see that ? Indeed, I can see that, as well as this." ; //$starting_words_array = array('I '); $starting_words_array = array('Do','I '); $ending_words_array = array('?',','); //array ([0] => 'Do you see that ?' [1] => 'I can see that,') function SearchString($str, $starting_words_array, $ending_words_array ) { $res = []; forEach($starting_words_array as $test) { $pos = strpos($str, $test); if ($pos===false) continue; $found = []; forEach($ending_words_array as $test2) { $posStart = $pos+strlen($test); $pos2 = strpos($str, $test2, $posStart); $found[] = ($pos2!==false) ? $pos2 : INF; } $min = min($found); if ($min !== INF) $res[]= substr($str,$pos,$min-$pos) .$str[$min]; } return $res; } $ans = SearchString($str, $starting_words_array, $ending_words_array ); print_r($ans);

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.4.140.0110.01117.79
8.4.130.0120.00718.97
8.4.120.0090.01223.93
8.4.110.0160.00418.73
8.4.100.0090.01118.70
8.4.90.0140.00620.35
8.4.80.0140.00617.66
8.4.70.0100.01017.91
8.4.60.0130.00818.59
8.4.50.0050.00417.98
8.4.40.0060.01320.34
8.4.30.0180.00018.95
8.4.20.0100.01022.38
8.4.10.0120.00019.63
8.3.270.0130.00616.36
8.3.260.0130.00516.64
8.3.250.0110.00818.75
8.3.240.0100.00617.18
8.3.230.0120.00716.61
8.3.220.0030.00517.36
8.3.210.0100.00916.73
8.3.200.0130.00618.27
8.3.190.0030.00519.04
8.3.180.0100.00916.63
8.3.170.0140.00417.31
8.3.160.0070.01118.50
8.3.150.0060.00316.61
8.3.140.0110.00418.37
8.3.130.0030.00518.45
8.3.120.0090.00620.67
8.3.110.0080.00020.94
8.3.100.0000.00816.63
8.3.90.0060.00316.68
8.3.80.0060.00319.36
8.3.70.0150.00316.88
8.3.60.0070.00718.43
8.3.50.0110.00523.74
8.3.40.0100.01020.33
8.3.30.0080.00818.70
8.3.20.0050.00224.18
8.3.10.0030.00624.66
8.3.00.0070.00026.16
8.2.290.0120.00720.53
8.2.280.0050.01318.27
8.2.270.0040.00417.24
8.2.260.0070.00716.93
8.2.250.0050.00318.42
8.2.240.0060.00318.98
8.2.230.0030.00622.58
8.2.220.0000.00824.06
8.2.210.0040.00426.77
8.2.200.0060.00316.50
8.2.190.0070.01116.58
8.2.180.0060.00925.92
8.2.170.0100.01018.74
8.2.160.0100.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00426.35
8.2.110.0060.00320.47
8.2.100.0040.00817.91
8.2.90.0040.00417.75
8.2.80.0030.00518.82
8.2.70.0030.00617.63
8.2.60.0040.00417.63
8.2.50.0050.00518.10
8.2.40.0000.00719.30
8.2.30.0000.00719.31
8.2.20.0040.00418.05
8.2.10.0000.00819.20
8.2.00.0000.00719.32
8.1.330.0090.00721.95
8.1.320.0150.00516.04
8.1.310.0130.00318.44
8.1.300.0140.00420.24
8.1.290.0070.00318.88
8.1.280.0110.00425.92
8.1.270.0120.00620.64
8.1.260.0070.00028.09
8.1.250.0110.00328.09
8.1.240.0000.01122.13
8.1.230.0070.00320.95
8.1.220.0040.00418.60
8.1.210.0040.00418.77
8.1.200.0050.00317.23
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0080.00018.69
8.1.160.0050.00318.86
8.1.150.0000.00818.89
8.1.140.0040.00418.92
8.1.130.0070.00017.32
8.1.120.0000.00717.43
8.1.110.0000.00717.48
8.1.100.0000.00817.35
8.1.90.0030.00517.46
8.1.80.0030.00717.41
8.1.70.0100.00017.43
8.1.60.0020.00517.55
8.1.50.0040.00417.55
8.1.40.0070.00317.39
8.1.30.0000.00717.52
8.1.20.0040.00417.61
8.1.10.0090.00017.59
8.1.00.0000.00817.40
8.0.300.0070.00018.77
8.0.290.0070.00416.75
8.0.280.0040.00418.49
8.0.270.0050.00316.87
8.0.260.0030.00316.70
8.0.250.0030.00316.97
8.0.240.0000.00717.00
8.0.230.0030.00416.95
8.0.220.0000.00816.91
8.0.210.0030.00316.87
8.0.200.0060.00016.93
8.0.190.0000.00716.83
8.0.180.0070.00016.95
8.0.170.0000.00916.80
8.0.160.0040.00416.93
8.0.150.0040.00416.74
8.0.140.0000.00716.91
8.0.130.0000.00613.29
8.0.120.0040.00416.76
8.0.110.0090.00016.93
8.0.100.0050.00316.84
8.0.90.0040.00416.80
8.0.80.0100.00516.88
8.0.70.0050.00316.76
8.0.60.0060.00316.80
8.0.50.0000.00816.88
8.0.30.0140.01117.04
8.0.20.0120.00617.06
8.0.10.0000.00716.85
8.0.00.0080.01116.94
7.4.330.0060.00015.55
7.4.320.0030.00316.52
7.4.300.0070.00016.61
7.4.290.0000.00716.48
7.4.280.0040.00416.47
7.4.270.0030.00716.44
7.4.260.0050.00013.34
7.4.250.0040.00416.56
7.4.240.0000.00716.56
7.4.230.0070.00016.69
7.4.220.0050.00216.46
7.4.210.0080.00916.53
7.4.200.0000.00716.63
7.4.130.0120.00616.53
7.4.120.0140.00616.41
7.4.110.0070.01116.46
7.4.100.0030.01516.49
7.4.90.0230.00916.26
7.4.80.0210.01216.68
7.4.70.0200.00516.50
7.4.60.0250.01016.29
7.4.50.0200.00616.55
7.4.40.0110.01316.40
7.4.30.0150.01116.49
7.4.20.0160.00616.20
7.4.10.0210.01016.44
7.4.00.0110.01116.56
7.3.330.0000.00716.22
7.3.320.0020.00213.18
7.3.310.0030.00316.26
7.3.300.0000.00716.40
7.3.290.0070.00716.37
7.3.260.0120.00616.60
7.3.230.0090.00916.31
7.3.220.0140.02216.47
7.3.210.0320.00316.61
7.3.200.0240.00316.58
7.3.190.0140.01016.65
7.3.180.0180.00616.45
7.3.170.0120.01216.20
7.3.160.0260.00516.29
7.3.150.0150.01216.41
7.3.140.0120.01216.18
7.3.130.0220.01116.46
7.3.120.0220.01116.23
7.3.110.0220.01316.43
7.3.100.0310.00316.61
7.3.90.0330.00016.41
7.3.80.0280.01116.36
7.3.70.0300.01116.39
7.3.60.0190.01216.48
7.3.50.0250.01116.57
7.3.40.0290.00916.45
7.3.30.0290.01116.48
7.3.20.0200.01616.47
7.3.10.0240.01616.34
7.3.00.0260.00916.47
7.2.330.0240.00816.57
7.2.320.0200.00816.77
7.2.310.0180.00916.42
7.2.300.0070.01516.55
7.2.290.0250.00516.45
7.2.280.0230.00716.91
7.2.270.0210.01016.59
7.2.260.0230.01216.80
7.2.250.0150.01516.63
7.2.240.0230.00916.39
7.2.230.0300.00016.54
7.2.220.0260.01016.70
7.2.210.0330.00616.46
7.2.200.0280.00516.82
7.2.190.0320.00516.57
7.2.180.0280.00916.68
7.2.170.0180.01816.70
7.2.160.0320.00716.73
7.2.150.0240.01216.91
7.2.140.0250.00616.75
7.2.130.0270.00816.85
7.2.120.0330.00616.81
7.2.110.0210.01316.85
7.2.100.0250.00716.75
7.2.90.0220.01516.73
7.2.80.0310.00416.55
7.2.70.0220.01016.68
7.2.60.0310.00316.72
7.2.50.0190.01316.77
7.2.40.0130.01716.79
7.2.30.0250.00716.87
7.2.20.0210.01216.75
7.2.10.0130.01716.73
7.2.00.0220.00916.59

preferences:
32.65 ms | 403 KiB | 5 Q