3v4l.org

run code in 300+ PHP versions simultaneously
<?php $meta_pattern = '/(?<=^|%3$s|\s)(?:(?!\S*%3$s\S*)\S+\s+){0,%2$d}(?:(?!\S*%3$s\S*%1$s)\S*)?%1$s\S*?(?:\s+\S+?){0,%2$d}(?=$|%3$s|\s)/'; $reg = sprintf($meta_pattern, preg_quote('search','/'), 3, preg_quote('$@','/')); $tests = array( array('input' => 'a b c d search e f g h', 'expected' => 'b c d search e f g'), array('input' => 'b c d search e f g h', 'expected' => 'b c d search e f g'), array('input' => 'a b c d search e f g', 'expected' => 'b c d search e f g'), array('input' => 'c d search e f g h', 'expected' => 'c d search e f g'), array('input' => 'a b c d search e f', 'expected' => 'b c d search e f'), array('input' => 'a$@b c d search e f g h', 'expected' => 'b c d search e f g'), array('input' => 'a b c d search e f g$@h', 'expected' => 'b c d search e f g'), array('input' => 'a b$@c d search e f g h', 'expected' => 'c d search e f g'), array('input' => 'a b c d search e f$@g h', 'expected' => 'b c d search e f'), array('input' => 'a b c$@d search e f g h', 'expected' => 'd search e f g'), array('input' => 'a b c d search e$@f g h', 'expected' => 'b c d search e'), array('input' => 'a b c d$@search e f g h', 'expected' => 'search e f g'), array('input' => 'a b c d search$@e f g h', 'expected' => 'b c d search'), array('input' => 'a b c d$@search$@e f g h', 'expected' => 'search'), array('input' => 'a b c d xsearchx e f g h', 'expected' => 'b c d xsearchx e f g'), array('input' => 'b c d xsearchx e f g h', 'expected' => 'b c d xsearchx e f g'), array('input' => 'a b c d xsearchx e f g', 'expected' => 'b c d xsearchx e f g'), array('input' => 'c d xsearchx e f g h', 'expected' => 'c d xsearchx e f g'), array('input' => 'a b c d xsearchx e f', 'expected' => 'b c d xsearchx e f'), array('input' => 'a$@b c d xsearchx e f g h', 'expected' => 'b c d xsearchx e f g'), array('input' => 'a b c d xsearchx e f g$@h', 'expected' => 'b c d xsearchx e f g'), array('input' => 'a b$@c d xsearchx e f g h', 'expected' => 'c d xsearchx e f g'), array('input' => 'a b c d xsearchx e f$@g h', 'expected' => 'b c d xsearchx e f'), array('input' => 'a b c$@d xsearchx e f g h', 'expected' => 'd xsearchx e f g'), array('input' => 'a b c d xsearchx e$@f g h', 'expected' => 'b c d xsearchx e'), array('input' => 'a b c d$@xsearchx e f g h', 'expected' => 'xsearchx e f g'), array('input' => 'a b c d xsearchx$@e f g h', 'expected' => 'b c d xsearchx'), array('input' => 'a b c d$@xsearchx$@e f g h', 'expected' => 'xsearchx') ); foreach($tests as $test) { preg_match($reg,$test['input'],$res); assert($res && !empty($res[0]) && $res[0]==$test['expected'], $test['input']); }

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.0070.01416.75
8.3.50.0320.00422.10
8.3.40.0090.00618.96
8.3.30.0040.01419.22
8.3.20.0040.00420.15
8.3.10.0040.00421.73
8.3.00.0030.00619.38
8.2.180.0120.00618.42
8.2.170.0040.01122.96
8.2.160.0140.00722.36
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00319.67
8.2.110.0060.00319.39
8.2.100.0120.00018.00
8.2.90.0040.00419.16
8.2.80.0000.00818.00
8.2.70.0040.00417.59
8.2.60.0040.00417.93
8.2.50.0030.00618.07
8.2.40.0000.00820.01
8.2.30.0040.00418.15
8.2.20.0050.00317.93
8.2.10.0030.00518.13
8.2.00.0040.00417.95
8.1.280.0120.00925.92
8.1.270.0060.00318.98
8.1.260.0090.00026.35
8.1.250.0000.00728.09
8.1.240.0030.00623.92
8.1.230.0040.00817.73
8.1.220.0040.00417.78
8.1.210.0060.00318.77
8.1.200.0030.00617.25
8.1.190.0050.00317.35
8.1.180.0080.00018.10
8.1.170.0050.00320.47
8.1.160.0000.00722.00
8.1.150.0030.00618.97
8.1.140.0000.00817.54
8.1.130.0040.00417.91
8.1.120.0030.00517.73
8.1.110.0000.00817.72
8.1.100.0070.00017.56
8.1.90.0040.00417.61
8.1.80.0070.00017.70
8.1.70.0070.00017.68
8.1.60.0050.00517.81
8.1.50.0030.00617.78
8.1.40.0030.00717.69
8.1.30.0000.00817.88
8.1.20.0000.00917.93
8.1.10.0030.00617.68
8.1.00.0040.00417.60
8.0.300.0070.00018.77
8.0.290.0070.00017.00
8.0.280.0030.00418.58
8.0.270.0030.00317.34
8.0.260.0030.00317.30
8.0.250.0000.00717.20
8.0.240.0080.00017.13
8.0.230.0030.00617.16
8.0.220.0020.00517.12
8.0.210.0080.00016.96
8.0.200.0070.00017.09
8.0.190.0030.00617.16
8.0.180.0000.00717.14
8.0.170.0060.00317.18
8.0.160.0050.00317.17
8.0.150.0000.00717.04
8.0.140.0040.00416.96
8.0.130.0050.00513.50
8.0.120.0050.00317.13
8.0.110.0030.00517.10
8.0.100.0080.00017.05
8.0.90.0040.00417.08
8.0.80.0090.01217.16
8.0.70.0040.00416.97
8.0.60.0000.01016.98
8.0.50.0040.00417.06
8.0.30.0090.01117.24
8.0.20.0120.01117.45
8.0.10.0000.00717.18
8.0.00.0090.01217.00
7.4.330.0000.00515.14
7.4.320.0000.00716.79
7.4.300.0000.00716.70
7.4.290.0040.00416.80
7.4.280.0080.00016.82
7.4.270.0000.00716.70
7.4.260.0070.00016.65
7.4.250.0000.00716.88
7.4.240.0040.00416.88
7.4.230.0030.00516.91
7.4.220.0040.01616.69
7.4.210.0100.00716.88
7.4.200.0080.00016.90
7.4.160.0080.00816.84
7.4.150.0090.00917.40
7.4.140.0100.00917.86
7.4.130.0110.00716.82
7.4.120.0140.00516.90
7.4.110.0060.01816.77
7.4.100.0030.01516.80
7.4.90.0070.01116.66
7.4.80.0060.01719.39
7.4.70.0060.01217.00
7.4.60.0070.01116.71
7.4.50.0060.00316.52
7.4.40.0160.01216.75
7.4.30.0070.01416.66
7.4.00.0040.01115.31
7.3.330.0030.00313.29
7.3.320.0090.00313.49
7.3.310.0000.00816.35
7.3.300.0040.00416.52
7.3.290.0000.00716.34
7.3.280.0090.00816.54
7.3.270.0210.00017.40
7.3.260.0170.00016.61
7.3.250.0130.00716.65
7.3.240.0150.00316.69
7.3.230.0090.00916.70
7.3.210.0090.00916.87
7.3.200.0090.00919.39
7.3.190.0130.00416.87
7.3.180.0130.00316.82
7.3.170.0100.00716.64
7.3.160.0110.00616.73
7.2.330.0110.00616.82
7.2.320.0100.00716.61
7.2.310.0100.00716.71
7.2.300.0030.01516.88
7.2.290.0110.01116.85
7.2.60.0040.00417.13
7.2.00.0000.01419.82
7.1.200.0070.00715.84
7.1.100.0070.00718.28
7.1.70.0000.01017.50
7.1.60.0030.02219.50
7.1.50.0080.01516.89
7.1.00.0030.07322.57
7.0.200.0630.00415.24
7.0.140.0030.06321.95
7.0.60.0070.04020.09
7.0.50.0030.09017.80
7.0.40.0070.04020.08
7.0.30.0270.07720.12
7.0.20.0400.06720.23
7.0.10.0400.04020.19
7.0.00.0070.05320.16
5.6.280.0070.07021.05
5.6.210.0070.05720.63
5.6.200.0030.08718.21
5.6.190.0100.04020.48
5.6.180.0200.04320.60
5.6.170.0370.04720.33
5.6.160.0070.06020.71
5.6.150.0130.04018.14
5.6.140.0100.08018.22
5.6.130.0030.08318.11
5.6.120.0100.06321.17
5.6.110.0000.05021.16
5.6.100.0070.04021.01
5.6.90.0070.06021.00
5.6.80.0100.07320.41
5.6.70.0230.08320.45
5.5.350.0100.07720.43
5.5.340.0170.06317.93
5.5.330.0100.05020.12
5.5.320.0330.07320.17
5.5.310.0130.04720.13
5.5.300.0000.04317.96
5.5.290.0100.07317.88
5.5.280.0070.06020.71
5.5.270.0100.06720.66
5.5.260.0070.08720.79
5.5.250.0070.08720.70
5.5.240.0100.07320.06
5.4.450.0730.05319.08
5.4.440.1130.05319.43
5.4.430.0900.05719.31
5.4.420.0900.05719.60
5.4.410.0100.05719.49
5.4.400.0170.05318.52
5.4.390.0300.04018.55
5.4.380.0230.04718.60
5.4.370.0130.05318.49
5.4.360.0200.04718.66
5.4.350.0230.04718.60
5.4.340.0230.04718.68
5.4.320.0230.05018.69
5.4.310.0170.05018.73
5.4.300.0170.05318.56
5.4.290.0130.05718.71
5.4.280.0200.05018.72
5.4.270.0130.05718.59
5.4.260.0230.04718.70
5.4.250.0200.05318.67
5.4.240.0170.05318.51
5.4.230.0070.06018.55
5.4.220.0200.05018.68
5.4.210.0300.04018.63
5.4.200.0200.04316.48
5.4.190.0200.05018.50
5.4.180.0170.05018.70
5.4.170.0170.05718.63
5.4.160.0270.04018.60
5.4.150.0100.05718.49
5.4.140.0270.04716.26
5.4.130.0200.05016.29
5.4.120.0270.04716.29
5.4.110.0130.05016.15
5.4.100.0170.05316.35
5.4.90.0270.05316.25
5.4.80.0230.05316.16
5.4.70.0170.05016.16
5.4.60.0300.03716.30
5.4.50.0170.05016.25
5.4.40.0270.04716.22
5.4.30.0100.05716.16
5.4.20.0200.05316.08
5.4.10.0200.05316.24
5.4.00.0200.04715.55
5.3.290.0330.04314.68
5.3.280.0170.05314.59
5.3.270.0200.05314.58
5.3.260.0130.07014.73
5.3.250.0130.06014.69
5.3.240.0170.05714.63
5.3.230.0230.05014.69
5.3.220.0200.05714.60
5.3.210.0170.05714.51
5.3.200.0130.05714.55
5.3.190.0100.06014.51
5.3.180.0100.06314.57
5.3.170.0230.05014.57
5.3.160.0270.05714.67
5.3.150.0130.05314.57
5.3.140.0300.04314.65
5.3.130.0230.05014.57
5.3.120.0270.05314.57
5.3.110.0270.06714.49
5.3.100.0170.05014.03
5.3.90.0200.05714.01
5.3.80.0200.05314.05
5.3.70.0270.04714.20
5.3.60.0170.05014.11
5.3.50.0130.05313.93
5.3.40.0100.05713.96
5.3.30.0200.04713.92
5.3.20.0170.04713.71
5.3.10.0130.05013.69
5.3.00.0200.04713.74
5.2.170.0100.05311.39
5.2.160.0200.03711.16
5.2.150.0100.04711.39
5.2.140.0070.04711.11
5.2.130.0100.04311.13
5.2.120.0170.04011.17
5.2.110.0130.04011.13
5.2.100.0200.03711.17
5.2.90.0170.03711.27
5.2.80.0170.04011.26
5.2.70.0100.04311.19
5.2.60.0170.04011.07
5.2.50.0100.04711.10
5.2.40.0200.03311.03
5.2.30.0130.05010.94
5.2.20.0200.03711.05
5.2.10.0170.03710.87
5.2.00.0130.04310.73
5.1.60.0170.03010.10
5.1.50.0170.03310.04
5.1.40.0130.04010.09
5.1.30.0200.03010.48
5.1.20.0130.03710.61
5.1.10.0130.03710.14
5.1.00.0200.03010.09
5.0.50.0100.0278.66
5.0.40.0100.0278.50
5.0.30.0170.0378.32
5.0.20.0170.0208.44
5.0.10.0100.0278.25
5.0.00.0030.0478.32
4.4.90.0000.0305.96
4.4.80.0030.0275.95
4.4.70.0100.0205.94
4.4.60.0070.0235.97
4.4.50.0070.0235.95
4.4.40.0100.0335.97
4.4.30.0100.0206.00
4.4.20.0030.0276.04
4.4.10.0100.0236.00
4.4.00.0130.0335.91
4.3.110.0100.0205.86
4.3.100.0030.0275.88
4.3.90.0070.0235.84
4.3.80.0070.0435.83
4.3.70.0030.0335.87
4.3.60.0070.0235.82
4.3.50.0130.0175.85
4.3.40.0070.0375.80
4.3.30.0130.0134.61
4.3.20.0030.0234.56
4.3.10.0100.0174.63
4.3.00.0100.0237.11

preferences:
34.68 ms | 401 KiB | 5 Q