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' => ''), array('input' => 'a b c d search e f g', 'expected' => ''), array('input' => 'c d search e f g h', 'expected' => ''), array('input' => 'a b c d search e f', 'expected' => ''), array('input' => 'a$@b c d search e f g h', 'expected' => ''), array('input' => 'a b c d search e f g$@h', 'expected' => ''), array('input' => 'a b$@c d search e f g h', 'expected' => ''), array('input' => 'a b c d search e f$@g h', 'expected' => ''), array('input' => 'a b c$@d search e f g h', 'expected' => ''), array('input' => 'a b c d search e$@f g h', 'expected' => ''), array('input' => 'a b c d$@search e f g h', 'expected' => ''), array('input' => 'a b c d search$@e f g h', 'expected' => ''), array('input' => 'a b c d$@search$@e f g h', 'expected' => ''), array('input' => 'a b c d xsearchx e f g h', 'expected' => ''), array('input' => 'b c d xsearchx e f g h', 'expected' => ''), array('input' => 'a b c d xsearchx e f g', 'expected' => ''), array('input' => 'c d xsearchx e f g h', 'expected' => ''), array('input' => 'a b c d xsearchx e f', 'expected' => ''), array('input' => 'a$@b c d xsearchx e f g h', 'expected' => ''), array('input' => 'a b c d xsearchx e f g$@h', 'expected' => ''), array('input' => 'a b$@c d xsearchx e f g h', 'expected' => ''), array('input' => 'a b c d xsearchx e f$@g h', 'expected' => ''), array('input' => 'a b c$@d xsearchx e f g h', 'expected' => ''), array('input' => 'a b c d xsearchx e$@f g h', 'expected' => ''), array('input' => 'a b c d$@xsearchx e f g h', 'expected' => ''), array('input' => 'a b c d xsearchx$@e f g h', 'expected' => ''), array('input' => 'a b c d$@xsearchx$@e f g h', 'expected' => '') ); 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.0140.00016.75
8.3.50.0070.01118.41
8.3.40.0070.00719.10
8.3.30.0150.00018.98
8.3.20.0080.00020.16
8.3.10.0040.00421.91
8.3.00.0040.00419.63
8.2.180.0100.01018.66
8.2.170.0040.01122.96
8.2.160.0130.01022.14
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00820.03
8.2.110.0030.00621.16
8.2.100.0040.00718.09
8.2.90.0050.00319.28
8.2.80.0060.00317.97
8.2.70.0040.00417.88
8.2.60.0110.00317.93
8.2.50.0000.00818.07
8.2.40.0030.00619.91
8.2.30.0040.00418.19
8.2.20.0030.00517.91
8.2.10.0040.00418.25
8.2.00.0000.00918.00
8.1.280.0070.00725.92
8.1.270.0040.00418.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0000.00919.59
8.1.230.0130.00019.11
8.1.220.0000.00817.78
8.1.210.0050.00318.77
8.1.200.0030.00617.48
8.1.190.0040.00417.60
8.1.180.0040.00418.10
8.1.170.0000.00820.25
8.1.160.0040.00422.13
8.1.150.0080.00019.01
8.1.140.0040.00417.71
8.1.130.0030.00317.81
8.1.120.0030.00517.55
8.1.110.0040.00417.56
8.1.100.0000.00717.67
8.1.90.0040.00417.64
8.1.80.0040.00417.66
8.1.70.0040.00417.68
8.1.60.0050.00317.77
8.1.50.0060.00317.71
8.1.40.0070.00417.72
8.1.30.0050.00317.76
8.1.20.0000.00917.69
8.1.10.0000.00917.75
8.1.00.0000.00917.73
8.0.300.0040.00421.99
8.0.290.0050.00317.00
8.0.280.0050.00318.50
8.0.270.0070.00017.25
8.0.260.0000.00817.29
8.0.250.0070.00017.11
8.0.240.0030.00317.23
8.0.230.0070.00417.21
8.0.220.0000.00717.16
8.0.210.0040.00417.04
8.0.200.0000.00717.17
8.0.190.0000.00717.28
8.0.180.0000.00817.10
8.0.170.0040.00417.02
8.0.160.0040.00417.15
8.0.150.0000.00717.10
8.0.140.0030.00517.00
8.0.130.0040.00413.56
8.0.120.0080.00017.04
8.0.110.0040.00417.16
8.0.100.0070.00017.13
8.0.90.0000.00717.28
8.0.80.0090.01217.14
8.0.70.0000.00717.09
8.0.60.0000.00817.05
8.0.50.0050.00217.02
8.0.30.0070.01717.52
8.0.20.0090.01217.42
8.0.10.0040.00417.05
8.0.00.0080.00917.04
7.4.330.0030.00315.19
7.4.320.0000.00716.88
7.4.300.0030.00316.83
7.4.290.0000.00816.66
7.4.280.0020.00516.77
7.4.270.0070.00016.85
7.4.260.0000.00816.64
7.4.250.0000.00816.80
7.4.240.0050.00316.76
7.4.230.0040.00416.76
7.4.220.0130.00816.87
7.4.210.0120.00716.78
7.4.200.0070.00016.84
7.4.160.0120.00416.69
7.4.150.0060.01317.40
7.4.140.0110.01017.86
7.4.130.0110.00616.78
7.4.120.0070.01016.97
7.4.110.0040.01416.89
7.4.100.0090.00916.82
7.4.90.0170.00016.64
7.4.80.0140.00819.39
7.4.70.0080.00816.82
7.4.60.0130.00416.82
7.4.50.0060.00316.65
7.4.40.0160.00716.83
7.4.30.0150.00317.00
7.4.10.0040.01215.38
7.4.00.0070.01115.33
7.3.330.0030.00313.41
7.3.320.0080.00413.40
7.3.310.0030.00416.52
7.3.300.0070.00016.63
7.3.290.0030.00316.45
7.3.280.0070.01016.58
7.3.270.0100.01017.40
7.3.260.0100.00816.69
7.3.250.0080.01016.71
7.3.240.0080.01016.70
7.3.230.0090.00916.81
7.3.210.0040.01516.84
7.3.200.0070.01419.39
7.3.190.0090.00816.79
7.3.180.0140.00316.66
7.3.170.0090.00916.64
7.3.160.0180.00016.77
7.3.130.0090.00915.17
7.3.120.0060.01115.27
7.3.110.0090.00615.26
7.3.100.0020.01015.13
7.3.90.0050.00814.96
7.3.80.0060.00815.16
7.3.70.0080.00715.05
7.3.60.0070.01115.16
7.3.50.0040.01115.05
7.3.40.0030.01015.01
7.3.30.0050.00915.18
7.3.20.0060.00917.04
7.3.10.0100.00616.79
7.3.00.0020.00817.04
7.2.330.0230.00316.96
7.2.320.0090.00916.87
7.2.310.0070.01016.95
7.2.300.0150.00316.94
7.2.290.0130.01016.93
7.2.260.0040.01815.39
7.2.250.0110.00715.12
7.2.240.0060.01015.32
7.2.230.0050.01015.43
7.2.220.0020.01415.32
7.2.210.0030.01215.35
7.2.200.0060.00815.33
7.2.190.0110.00515.23
7.2.180.0070.00515.22
7.2.170.0020.01215.29
7.2.160.0040.00815.47
7.2.150.0110.00317.28
7.2.140.0110.00417.25
7.2.130.0040.00816.89
7.2.120.0060.00616.93
7.2.110.0000.01116.98
7.2.100.0030.00917.11
7.2.90.0070.01017.25
7.2.80.0160.00017.25
7.2.70.0000.01216.94
7.2.60.0110.00416.96
7.2.50.0100.00716.97
7.2.40.0040.01417.27
7.2.30.0120.00617.27
7.2.20.0030.01017.13
7.2.10.0080.00817.23
7.2.00.0060.00718.27
7.1.330.0070.00715.84
7.1.320.0050.00715.95
7.1.310.0040.01116.12
7.1.300.0070.00916.10
7.1.290.0070.00816.02
7.1.280.0060.00816.07
7.1.270.0030.01016.07
7.1.260.0080.00715.96
7.1.250.0030.00916.18
7.1.240.0000.01016.04
7.1.230.0080.00416.11
7.1.220.0140.00016.06
7.1.210.0030.01216.09
7.1.200.0060.00616.13
7.1.190.0040.00815.98
7.1.180.0090.00315.96
7.1.170.0000.01416.09
7.1.160.0070.01015.91
7.1.150.0030.00616.09
7.1.140.0100.00716.19
7.1.130.0040.01116.14
7.1.120.0070.01015.73
7.1.110.0060.00316.03
7.1.100.0060.00817.34
7.1.90.0070.00716.10
7.1.80.0050.00516.13
7.1.70.0030.00816.57
7.1.60.0080.00517.83
7.1.50.0070.01216.31
7.1.40.0040.00715.93
7.1.30.0090.00316.18
7.1.20.0040.01115.75
7.1.10.0060.00915.95
7.1.00.0030.04019.15
7.0.330.0040.00715.58
7.0.320.0000.00815.56
7.0.310.0040.01115.19
7.0.300.0100.00615.46
7.0.290.0070.00315.34
7.0.280.0110.00015.45
7.0.270.0000.01415.70
7.0.260.0000.00815.39
7.0.250.0070.00715.41
7.0.240.0080.00415.70
7.0.230.0090.00615.82
7.0.220.0000.01315.66
7.0.210.0030.01015.23
7.0.200.0180.01115.34
7.0.190.0090.00615.73
7.0.180.0060.00615.70
7.0.170.0030.00915.59
7.0.160.0030.01015.67
7.0.150.0000.01515.23
7.0.140.0080.03918.88
7.0.130.0000.00915.73
7.0.120.0040.01115.64
7.0.110.0030.01015.68
7.0.100.0040.01215.66
7.0.90.0030.01315.71
7.0.80.0060.00915.81
7.0.70.0090.00615.77
7.0.60.0130.03317.87
7.0.50.0070.03516.80
7.0.40.0070.04416.92
7.0.30.0210.04316.94
7.0.20.0110.04716.78
7.0.10.0180.03617.07
7.0.00.0070.02316.97
5.6.400.0030.00714.77
5.6.390.0090.00014.37
5.6.380.0030.01014.77
5.6.370.0030.00614.84
5.6.360.0040.01114.68
5.6.350.0070.01014.52
5.6.340.0000.01514.53
5.6.330.0040.01114.29
5.6.320.0040.01114.52
5.6.310.0100.00714.77
5.6.300.0040.01114.69
5.6.290.0030.01314.61
5.6.280.0040.03917.78
5.6.270.0120.00314.73
5.6.260.0100.00314.61
5.6.250.0070.01014.30
5.6.240.0080.00814.58
5.6.230.0060.00914.58
5.6.220.0040.00814.45
5.6.210.0130.02517.55
5.6.200.0080.02216.26
5.6.190.0140.04017.37
5.6.180.0250.04017.52
5.6.170.0180.04317.45
5.6.160.0080.04817.32
5.6.150.0090.02116.40
5.6.140.0050.02916.41
5.6.130.0030.05216.30
5.6.120.0130.03817.93
5.6.110.0050.04517.64
5.6.100.0120.04217.70
5.6.90.0070.03817.82
5.6.80.0080.04517.33
5.6.70.0120.03517.56
5.6.60.0040.01114.43
5.6.50.0070.01014.36
5.6.40.0070.00714.34
5.6.30.0080.00814.26
5.6.20.0070.00714.39
5.6.10.0100.00714.09
5.6.00.0000.01114.51
5.5.380.0070.00414.62
5.5.370.0040.01114.28
5.5.360.0030.01314.38
5.5.350.0120.04017.27
5.5.340.0090.02016.26
5.5.330.0080.04117.29
5.5.320.0130.04517.30
5.5.310.0070.02917.47
5.5.300.0100.04316.13
5.5.290.0040.02416.30
5.5.280.0050.04517.56
5.5.270.0050.03717.75
5.5.260.0060.04517.67
5.5.250.0140.02517.51
5.5.240.0060.04017.24
5.5.230.0000.01514.36
5.5.220.0070.00714.55
5.5.210.0030.00614.39
5.5.200.0080.00814.29
5.5.190.0000.01514.57
5.5.180.0030.01314.39
5.5.170.0080.00814.41
5.5.160.0090.00314.38
5.5.150.0030.01114.27
5.5.140.0000.01414.42
5.5.130.0030.00614.20
5.5.120.0060.00614.30
5.5.110.0060.00614.70
5.5.100.0040.00714.16
5.5.90.0100.00314.32
5.5.80.0030.01014.44
5.5.70.0070.00714.36
5.5.60.0030.00814.80
5.5.50.0000.01814.37
5.5.40.0070.01014.41
5.5.30.0070.01014.63
5.5.20.0060.00314.57
5.5.10.0060.00614.06
5.5.00.0040.01114.47
5.4.450.0420.03514.98
5.4.440.0400.03415.31
5.4.430.0420.03615.18
5.4.420.0360.03115.39
5.4.410.0080.03115.22
5.4.400.0160.03214.99
5.4.390.0140.03214.79
5.4.380.0220.02214.81
5.4.370.0140.03214.81
5.4.360.0130.02914.87
5.4.350.0140.03014.85
5.4.340.0180.02414.87
5.4.330.0000.00711.09
5.4.320.0160.02614.90
5.4.310.0130.03314.84
5.4.300.0190.02914.90
5.4.290.0110.03114.68
5.4.280.0130.03614.74
5.4.270.0150.02914.86
5.4.260.0160.02914.92
5.4.250.0100.03314.89
5.4.240.0100.03214.76
5.4.230.0070.03314.75
5.4.220.0110.03014.83
5.4.210.0130.02814.93
5.4.200.0130.02613.76
5.4.190.0100.03114.78
5.4.180.0170.02514.83
5.4.170.0160.03614.75
5.4.160.0200.02514.76
5.4.150.0080.03814.95
5.4.140.0140.03213.71
5.4.130.0070.03313.79
5.4.120.0070.03213.82
5.4.110.0140.03113.53
5.4.100.0130.02913.69
5.4.90.0130.02513.71
5.4.80.0150.03813.59
5.4.70.0110.03113.75
5.4.60.0070.03413.72
5.4.50.0150.03413.69
5.4.40.0200.02513.75
5.4.30.0110.03013.68
5.4.20.0130.03113.71
5.4.10.0100.03413.72
5.4.00.0180.02513.47
5.3.290.0300.04314.76
5.3.280.0070.06014.60
5.3.270.0130.05714.58
5.3.260.0130.06014.55
5.3.250.0200.05314.70
5.3.240.0170.05314.70
5.3.230.0270.04014.61
5.3.220.0200.05014.51
5.3.210.0230.04714.52
5.3.200.0400.05314.63
5.3.190.0230.05314.59
5.3.180.0170.05714.59
5.3.170.0200.05014.57
5.3.160.0130.05314.59
5.3.150.0100.06014.68
5.3.140.0200.06314.67
5.3.130.0200.05314.54
5.3.120.0130.06314.56
5.3.110.0230.05714.50
5.3.100.0170.05313.99
5.3.90.0270.05014.12
5.3.80.0130.06014.05
5.3.70.0230.04714.00
5.3.60.0270.05013.96
5.3.50.0130.05714.08
5.3.40.0300.04314.10
5.3.30.0170.05313.93
5.3.20.0270.04313.63
5.3.10.0230.05713.78
5.3.00.0130.06013.58
5.2.170.0170.04011.24
5.2.160.0230.03311.31
5.2.150.0100.04711.13
5.2.140.0130.04311.13
5.2.130.0130.05011.19
5.2.120.0170.03711.06
5.2.110.0230.03311.09
5.2.100.0100.04311.20
5.2.90.0170.04311.17
5.2.80.0300.04711.34
5.2.70.0230.05311.14
5.2.60.0130.05011.02
5.2.50.0200.04010.98
5.2.40.0100.05311.18
5.2.30.0170.04011.05
5.2.20.0130.04311.05
5.2.10.0100.04710.93
5.2.00.0170.04010.80
5.1.60.0200.02710.09
5.1.50.0130.03710.05
5.1.40.0100.03710.12
5.1.30.0100.04010.59
5.1.20.0200.03310.51
5.1.10.0200.03010.18
5.1.00.0200.04010.14
5.0.50.0100.0308.71
5.0.40.0100.0338.55
5.0.30.0070.0608.34
5.0.20.0070.0308.36
5.0.10.0070.0378.23
5.0.00.0100.0408.33
4.4.90.0070.0235.88
4.4.80.0130.0205.97
4.4.70.0070.0275.93
4.4.60.0070.0275.91
4.4.50.0030.0275.98
4.4.40.0070.0375.95
4.4.30.0100.0205.96
4.4.20.0070.0235.99
4.4.10.0100.0236.04
4.4.00.0030.0375.97
4.3.110.0030.0275.80
4.3.100.0170.0175.93
4.3.90.0170.0235.88
4.3.80.0070.0475.93
4.3.70.0030.0335.82
4.3.60.0100.0205.86
4.3.50.0070.0275.96
4.3.40.0000.0435.80
4.3.30.0100.0204.63
4.3.20.0070.0204.57
4.3.10.0070.0234.55
4.3.00.0070.0277.11

preferences:
36.7 ms | 400 KiB | 5 Q