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); if(!($res && !empty($res[0]) && $res[0]==$test['expected'])) { var_dump('Test '.$test['input'].' failed.'); } }

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.0160.00617.00
8.3.50.0100.00718.45
8.3.40.0060.00918.94
8.3.30.0140.00019.14
8.3.20.0080.00020.34
8.3.10.0000.00821.73
8.3.00.0000.00819.50
8.2.180.0140.00418.41
8.2.170.0120.00322.96
8.2.160.0130.00622.21
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0080.00019.89
8.2.110.0070.00320.96
8.2.100.0120.00017.84
8.2.90.0040.00418.28
8.2.80.0000.00818.00
8.2.70.0060.00318.00
8.2.60.0080.00017.93
8.2.50.0050.00318.07
8.2.40.0030.00620.05
8.2.30.0000.00918.12
8.2.20.0080.00017.94
8.2.10.0000.00818.23
8.2.00.0000.00817.83
8.1.280.0110.00425.92
8.1.270.0070.01019.13
8.1.260.0030.00626.35
8.1.250.0000.00728.09
8.1.240.0060.00323.73
8.1.230.0060.00621.17
8.1.220.0030.00517.74
8.1.210.0000.00919.07
8.1.200.0060.00317.38
8.1.190.0080.00017.48
8.1.180.0000.00818.10
8.1.170.0050.00320.54
8.1.160.0050.00322.10
8.1.150.0000.00818.85
8.1.140.0000.00917.66
8.1.130.0040.00417.88
8.1.120.0000.00717.61
8.1.110.0070.00017.63
8.1.100.0000.00717.56
8.1.90.0000.00717.56
8.1.80.0040.00417.55
8.1.70.0030.00317.72
8.1.60.0060.00317.85
8.1.50.0000.00817.60
8.1.40.0000.00917.71
8.1.30.0040.00417.83
8.1.20.0030.00517.71
8.1.10.0060.00317.76
8.1.00.0040.00417.72
8.0.300.0070.00019.98
8.0.290.0000.00716.88
8.0.280.0050.00318.53
8.0.270.0000.00717.30
8.0.260.0070.00017.34
8.0.250.0030.00317.10
8.0.240.0060.00317.03
8.0.230.0000.01017.18
8.0.220.0000.00717.03
8.0.210.0000.00717.09
8.0.200.0060.00017.11
8.0.190.0040.00417.02
8.0.180.0000.00717.15
8.0.170.0000.00817.09
8.0.160.0090.00017.12
8.0.150.0000.00716.95
8.0.140.0040.00416.96
8.0.130.0000.00813.59
8.0.120.0050.00317.02
8.0.110.0040.00417.02
8.0.100.0000.00717.10
8.0.90.0040.00417.17
8.0.80.0090.00617.14
8.0.70.0050.00217.00
8.0.60.0000.00817.02
8.0.50.0040.00416.90
8.0.30.0120.01017.21
8.0.20.0180.00917.51
8.0.10.0070.00017.04
8.0.00.0120.00917.01
7.4.330.0060.00015.03
7.4.320.0030.00316.73
7.4.300.0000.00616.82
7.4.290.0030.00516.77
7.4.280.0080.00016.86
7.4.270.0040.00416.88
7.4.260.0080.00016.77
7.4.250.0000.00716.84
7.4.240.0020.00616.79
7.4.230.0040.00416.88
7.4.220.0140.00716.83
7.4.210.0030.01216.87
7.4.200.0090.00016.68
7.4.160.0060.00916.82
7.4.150.0170.00017.40
7.4.140.0140.01117.86
7.4.130.0080.01016.84
7.4.120.0090.01116.69
7.4.110.0030.01516.87
7.4.100.0100.00716.88
7.4.90.0040.02116.73
7.4.80.0150.00919.39
7.4.70.0070.01116.61
7.4.60.0110.00716.83
7.4.50.0060.00316.63
7.4.40.0100.01416.67
7.4.30.0120.00616.87
7.4.00.0080.00815.28
7.3.330.0000.00613.36
7.3.320.0120.00013.42
7.3.310.0040.00416.60
7.3.300.0030.00316.42
7.3.290.0030.00316.40
7.3.280.0060.01216.53
7.3.270.0100.00717.40
7.3.260.0100.00716.79
7.3.250.0100.00816.79
7.3.240.0100.01016.77
7.3.230.0040.01916.53
7.3.210.0120.00616.84
7.3.200.0110.00719.39
7.3.190.0060.01216.63
7.3.180.0160.00016.78
7.3.170.0090.00916.61
7.3.160.0100.00616.94
7.3.120.0090.00914.96
7.3.110.0030.01115.05
7.3.100.0030.00915.00
7.3.90.0070.00715.27
7.3.80.0040.00714.84
7.3.70.0040.01415.22
7.3.60.0070.00715.04
7.3.50.0050.00515.10
7.3.40.0030.00715.00
7.3.30.0000.01115.04
7.3.20.0060.00616.61
7.3.10.0050.01016.91
7.3.00.0080.00716.91
7.2.330.0130.01016.79
7.2.320.0120.00616.83
7.2.310.0060.01216.85
7.2.300.0140.00316.83
7.2.290.0040.01516.88
7.2.240.0110.00315.23
7.2.230.0070.00715.31
7.2.220.0000.01115.38
7.2.210.0030.01415.17
7.2.200.0100.00315.29
7.2.190.0070.00315.26
7.2.180.0090.00015.37
7.2.170.0040.01115.38
7.2.160.0070.01014.98
7.2.150.0050.01216.98
7.2.140.0080.00417.21
7.2.130.0070.00417.08
7.2.120.0070.00717.20
7.2.110.0060.00517.09
7.2.100.0020.01017.07
7.2.90.0100.00317.17
7.2.80.0090.00517.06
7.2.70.0070.00717.05
7.2.60.0060.00717.08
7.2.50.0050.01016.92
7.2.40.0050.01117.07
7.2.30.0030.00817.22
7.2.20.0080.00817.25
7.2.10.0050.00517.15
7.2.00.0070.00617.97
7.1.330.0060.00615.97
7.1.320.0040.01115.97
7.1.310.0040.01115.70
7.1.300.0000.01216.07
7.1.290.0060.00615.93
7.1.280.0000.01216.02
7.1.270.0030.01015.77
7.1.260.0070.00715.96
7.1.250.0060.00516.11
7.1.200.0040.00416.06
7.1.100.0000.01618.48
7.1.70.0040.00717.31
7.1.60.0120.00819.50
7.1.50.0100.01317.21
7.1.00.0030.07722.34
7.0.200.0360.01015.20
7.0.140.0000.07722.18
7.0.60.0100.08319.95
7.0.50.0100.07717.84
7.0.40.0070.08719.98
7.0.30.0370.08020.20
7.0.20.0300.07020.41
7.0.10.0370.07720.08
7.0.00.0100.08720.19
5.6.280.0000.07720.95
5.6.210.0070.04720.72
5.6.200.0000.06018.21
5.6.190.0170.05720.48
5.6.180.0300.05720.70
5.6.170.0300.07020.51
5.6.160.0000.07320.70
5.6.150.0130.06018.23
5.6.140.0000.05718.19
5.6.130.0030.07018.14
5.6.120.0170.07721.10
5.6.110.0070.07021.14
5.6.100.0130.07721.11
5.6.90.0100.08021.05
5.6.80.0230.07020.52
5.6.70.0170.03720.38
5.5.350.0170.07720.55
5.5.340.0070.04017.96
5.5.330.0030.08720.21
5.5.320.0230.07320.44
5.5.310.0070.05020.32
5.5.300.0070.05017.98
5.5.290.0100.03717.89
5.5.280.0070.07321.00
5.5.270.0030.08320.99
5.5.260.0100.06320.86
5.5.250.0100.08320.72
5.5.240.0070.07720.28
5.4.450.0600.06019.31
5.4.440.0270.07719.28
5.4.430.1030.05719.54
5.4.420.0100.05719.44
5.4.410.1030.08019.16
5.4.400.0230.05318.80
5.4.390.0230.07718.71
5.4.380.0370.06718.69
5.4.370.0300.05718.54
5.4.360.0200.06318.55
5.4.350.0170.06718.61
5.4.340.0270.06318.74
5.4.320.0270.05018.70
5.4.310.0230.06318.64
5.4.300.0230.05318.66
5.4.290.0330.04718.77
5.4.280.0370.04018.68
5.4.270.0270.05018.71
5.4.260.0370.04318.70
5.4.250.0130.06318.61
5.4.240.0330.04718.70
5.4.230.0200.05318.59
5.4.220.0170.06318.55
5.4.210.0370.05018.68
5.4.200.0230.07016.40
5.4.190.0230.05718.76
5.4.180.0400.06018.68
5.4.170.0270.06018.59
5.4.160.0230.05318.71
5.4.150.0200.05718.64
5.4.140.0200.05716.20
5.4.130.0230.05016.29
5.4.120.0170.07016.19
5.4.110.0130.06316.25
5.4.100.0270.05316.27
5.4.90.0170.06316.20
5.4.80.0330.05016.23
5.4.70.0300.06016.22
5.4.60.0200.05316.26
5.4.50.0230.05716.34
5.4.40.0170.06016.14
5.4.30.0170.05316.06
5.4.20.0200.05316.25
5.4.10.0200.05016.06
5.4.00.0130.05315.74
5.3.290.0400.04714.75
5.3.280.0200.05714.69
5.3.270.0170.06714.62
5.3.260.0230.06314.79
5.3.250.0230.07314.73
5.3.240.0270.07014.63
5.3.230.0230.07314.62
5.3.220.0330.04314.56
5.3.210.0200.06014.58
5.3.200.0100.06314.75
5.3.190.0200.05714.56
5.3.180.0100.06014.66
5.3.170.0230.05314.67
5.3.160.0170.05714.52
5.3.150.0200.08014.67
5.3.140.0200.05014.74
5.3.130.0300.05314.53
5.3.120.0200.05714.51
5.3.110.0200.06014.56
5.3.100.0230.05314.02
5.3.90.0230.05314.01
5.3.80.0170.05314.08
5.3.70.0230.04314.14
5.3.60.0370.04013.94
5.3.50.0200.04713.93
5.3.40.0200.05013.88
5.3.30.0170.05314.04
5.3.20.0230.04713.69
5.3.10.0230.04313.71
5.3.00.0270.04713.58
5.2.170.0170.04311.12
5.2.160.0100.05011.14
5.2.150.0070.05311.20
5.2.140.0100.04711.20
5.2.130.0270.04311.20
5.2.120.0130.04311.20
5.2.110.0200.03711.27
5.2.100.0200.04011.16
5.2.90.0100.05011.17
5.2.80.0170.04311.16
5.2.70.0100.05011.34
5.2.60.0070.05011.14
5.2.50.0130.04311.09
5.2.40.0070.04711.03
5.2.30.0030.05311.05
5.2.20.0100.04311.02
5.2.10.0100.05311.03
5.2.00.0170.03710.77
5.1.60.0070.03710.11
5.1.50.0100.03710.18
5.1.40.0070.04710.03
5.1.30.0270.03010.52
5.1.20.0130.03710.45
5.1.10.0170.03010.11
5.1.00.0130.03310.13
5.0.50.0100.0278.61
5.0.40.0130.0238.43
5.0.30.0070.0438.38
5.0.20.0100.0278.27
5.0.10.0030.0308.41
5.0.00.0100.0538.20
4.4.90.0130.0235.93
4.4.80.0230.0175.97
4.4.70.0070.0205.92
4.4.60.0070.0205.92
4.4.50.0070.0235.97
4.4.40.0070.0335.92
4.4.30.0070.0205.97
4.4.20.0070.0235.95
4.4.10.0030.0236.03
4.4.00.0070.0335.98
4.3.110.0130.0175.82
4.3.100.0030.0235.85
4.3.90.0100.0205.83
4.3.80.0030.0375.96
4.3.70.0030.0235.85
4.3.60.0000.0275.82
4.3.50.0100.0205.87
4.3.40.0070.0335.80
4.3.30.0030.0234.59
4.3.20.0030.0234.66
4.3.10.0030.0234.59
4.3.00.0130.0207.11

preferences:
42.26 ms | 400 KiB | 5 Q