3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bads = array('+11','- 68','[img','$cool', '# hash'); // disallowed full 'words'; if one of them appears in string, the function should return true $s= 'This is test to show if or $cool works but it does not'; //another example to test: $s= 'This - 68 is # hash not'; if(contains($s,$bads)) { echo 'Contains! '; } #### FUNCTION ### function contains($str, $bads) { //var_dump($bads); $b = "/"; foreach($bads as $a) { if(substr($a,0,1) == "$"){ $b .= preg_quote($a,'/'). "|"; }else{ $b .= "\b" . preg_quote($a,'/'). "\b|"; } } $b = substr($b, 0,-1) ."/"; echo $b; if(preg_match($b,$str, $m)){ var_dump($m); return true; } return false; }

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.0120.00917.83
8.4.130.0120.00817.90
8.4.120.0120.00824.02
8.4.110.0080.01120.55
8.4.100.0100.01018.96
8.4.90.0120.00820.42
8.4.80.0070.00518.82
8.4.70.0110.00820.71
8.4.60.0120.00918.75
8.4.50.0070.00218.81
8.4.40.0090.00619.88
8.4.30.0100.01018.64
8.4.20.0100.01017.66
8.4.10.0060.01319.72
8.3.270.0120.00716.61
8.3.260.0120.00916.95
8.3.250.0100.01017.25
8.3.240.0090.00817.08
8.3.230.0100.00916.74
8.3.220.0030.00618.86
8.3.210.0110.00816.70
8.3.200.0050.00616.66
8.3.190.0060.01217.34
8.3.180.0140.00519.09
8.3.170.0090.00916.67
8.3.160.0110.00717.08
8.3.150.0060.01217.02
8.3.140.0150.00018.36
8.3.130.0040.00418.78
8.3.120.0030.00620.75
8.3.110.0000.00920.94
8.3.100.0090.00024.06
8.3.90.0070.01526.77
8.3.80.0030.00619.36
8.3.70.0070.00716.75
8.3.60.0100.00716.63
8.3.50.0070.00916.77
8.3.40.0090.00918.92
8.3.30.0160.00018.97
8.3.20.0000.00821.95
8.3.10.0070.00021.85
8.3.00.0030.00518.03
8.2.290.0070.00520.32
8.2.280.0110.00918.38
8.2.270.0140.00416.98
8.2.260.0050.00316.59
8.2.250.0050.00318.64
8.2.240.0050.00516.95
8.2.230.0090.00022.58
8.2.220.0120.00337.54
8.2.210.0040.00426.77
8.2.200.0060.00318.88
8.2.190.0070.00716.58
8.2.180.0100.01018.41
8.2.170.0060.01322.96
8.2.160.0140.00021.18
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0080.00020.38
8.2.120.0050.00226.35
8.2.110.0030.00821.12
8.2.100.0080.00417.97
8.2.90.0000.00819.26
8.2.80.0040.00418.05
8.2.70.0000.00817.88
8.2.60.0090.00018.34
8.2.50.0030.00518.10
8.2.40.0040.00420.60
8.2.30.0050.00319.26
8.2.20.0040.00418.14
8.2.10.0080.00018.04
8.2.00.0000.00818.27
8.1.330.0120.00721.89
8.1.320.0150.00816.32
8.1.310.0050.00316.35
8.1.300.0030.00618.61
8.1.290.0060.00330.84
8.1.280.0120.00325.92
8.1.270.0000.00922.00
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0040.00423.97
8.1.230.0040.00819.17
8.1.220.0000.00917.74
8.1.210.0090.00018.77
8.1.200.0070.00317.47
8.1.190.0060.00317.48
8.1.180.0000.00818.10
8.1.170.0080.00018.71
8.1.160.0020.00519.00
8.1.150.0080.00020.18
8.1.140.0030.00519.57
8.1.130.0030.00518.91
8.1.120.0040.00417.63
8.1.110.0080.00017.54
8.1.100.0040.00417.55
8.1.90.0000.00717.64
8.1.80.0040.00417.65
8.1.70.0040.00417.64
8.1.60.0030.00517.75
8.1.50.0040.00417.74
8.1.40.0030.00617.67
8.1.30.0040.00717.75
8.1.20.0000.00917.82
8.1.10.0000.00817.70
8.1.00.0030.00517.50
8.0.300.0050.00318.77
8.0.290.0040.00416.88
8.0.280.0050.00318.52
8.0.270.0030.00316.98
8.0.260.0030.00317.05
8.0.250.0070.00017.18
8.0.240.0000.00817.16
8.0.230.0000.00717.09
8.0.220.0000.00717.00
8.0.210.0040.00416.99
8.0.200.0000.00717.10
8.0.190.0030.00717.03
8.0.180.0030.00517.06
8.0.170.0000.00716.95
8.0.160.0000.00717.07
8.0.150.0070.00016.97
8.0.140.0050.00217.05
8.0.130.0060.00013.46
8.0.120.0050.00217.05
8.0.110.0070.00016.91
8.0.100.0040.00417.09
8.0.90.0040.00417.07
8.0.80.0080.00816.99
8.0.70.0050.00217.07
8.0.60.0000.00717.05
8.0.50.0070.00016.98
8.0.30.0070.00917.24
8.0.20.0080.01017.40
8.0.10.0000.00717.07
8.0.00.0070.01016.81
7.4.330.0060.00015.55
7.4.320.0060.00016.83
7.4.300.0060.00016.63
7.4.290.0030.00316.75
7.4.280.0050.00316.83
7.4.270.0000.00716.63
7.4.260.0030.00313.49
7.4.250.0040.00416.74
7.4.240.0040.00416.84
7.4.230.0030.00616.53
7.4.220.0150.00416.77
7.4.210.0070.00716.90
7.4.200.0040.00316.91
7.4.160.0060.01216.73
7.4.150.0060.01117.40
7.4.140.0120.00817.86
7.4.130.0180.00616.61
7.4.120.0080.01016.72
7.4.110.0140.00716.64
7.4.100.0180.00016.91
7.4.90.0060.01116.69
7.4.80.0130.00319.39
7.4.70.0060.01616.55
7.4.60.0060.01016.66
7.4.50.0070.01116.52
7.4.40.0030.01316.61
7.4.30.0130.00316.77
7.4.00.0070.01015.25
7.3.330.0000.00613.45
7.3.320.0030.00313.45
7.3.310.0040.00416.34
7.3.300.0030.00316.31
7.3.290.0090.00616.45
7.3.280.0080.00916.43
7.3.270.0030.01417.40
7.3.260.0160.00516.87
7.3.250.0120.00916.72
7.3.240.0150.00416.54
7.3.230.0220.00916.83
7.3.210.0090.00916.62
7.3.200.0110.00816.65
7.3.190.0080.01016.62
7.3.180.0070.01116.44
7.3.170.0090.01416.78
7.3.160.0130.01016.45
7.3.120.0060.01215.27
7.3.110.0040.01415.18
7.3.100.0090.00915.24
7.3.90.0110.00015.02
7.3.80.0060.00614.96
7.3.70.0030.00715.09
7.3.60.0000.01714.89
7.3.50.0000.01115.11
7.3.40.0060.00614.89
7.3.30.0070.01015.13
7.3.20.0100.00716.88
7.3.10.0060.01516.70
7.3.00.0150.00216.62
7.2.330.0070.01016.71
7.2.320.0120.00616.64
7.2.310.0140.00316.62
7.2.300.0040.01117.04
7.2.290.0110.00616.86
7.2.250.0100.01015.29
7.2.240.0040.01115.43
7.2.230.0040.01215.18
7.2.220.0060.00615.18
7.2.210.0060.01015.43
7.2.200.0090.00615.02
7.2.190.0040.01215.23
7.2.180.0060.00915.23
7.2.170.0110.00015.11
7.2.130.0090.00917.04
7.2.120.0100.01116.79
7.2.110.0100.01016.92
7.2.100.0140.00416.87
7.2.90.0110.01116.64
7.2.80.0240.00316.99
7.2.70.0070.01416.88
7.2.60.0120.00416.94
7.2.50.0110.00416.63
7.2.40.0140.00316.96
7.2.30.0110.00716.30
7.2.20.0100.00717.03
7.2.10.0100.01017.11
7.2.00.0110.00717.02
7.1.330.0070.00716.15
7.1.320.0030.01015.98
7.1.310.0070.00716.19
7.1.300.0070.01015.93
7.1.290.0030.00815.93
7.1.280.0040.01115.79
7.1.270.0140.00716.14
7.1.260.0030.00616.14
7.1.250.0170.00015.41
7.1.200.0000.01615.88
7.1.70.0000.01517.59
7.1.60.0730.01333.49
7.1.50.1100.01733.17
7.1.40.0730.01733.09
7.1.30.0870.00733.01
7.1.20.0900.00733.05
7.1.10.0830.01714.93
7.1.00.0830.01015.14
7.0.200.1100.01315.12
7.0.190.0730.01014.92
7.0.180.1000.01714.74
7.0.170.0870.01314.70
7.0.160.0600.01314.64
7.0.150.1270.01014.76
7.0.140.0570.01314.88
7.0.130.0670.01314.86
7.0.120.1000.01715.09
7.0.110.0870.01315.00
7.0.100.0570.01314.68
7.0.90.0730.01014.77
7.0.80.0570.01314.86
7.0.70.0730.00714.72
7.0.60.0630.01014.69
7.0.50.0700.01314.74
7.0.40.0770.00714.82
7.0.30.0930.01014.80
7.0.20.0900.01314.81
7.0.10.1130.00714.73
7.0.00.0870.01714.75

preferences:
30.21 ms | 403 KiB | 5 Q