3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xss_clean($str){ // Remove all NULL bytes $str = str_replace("\0", '', $str); // Fix &entity\n; $str = str_replace(array('&','<','>'), array('&amp;','&lt;','&gt;'), $str); $str = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '$1;', $str); $str = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $str); $str = preg_replace('#(<[^>]+?;base64,.+>|<[^>]+?.+;base64,.+>.+<\/.+>)#','',$str); //$str = html_entity_decode($str, ENT_COMPAT, $charset); //org $str = html_entity_decode($str, ENT_COMPAT); // Remove any attribute starting with "on" or xmlns $str = preg_replace('#(?:on[a-z]+|xmlns)\s*=\s*[\'"\x00-\x20]?[^\'>"]*[\'"\x00-\x20]?\s?#iu', '', $str); // Remove javascript: and vbscript: protocols $str = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $str); $str = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $str); $str = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $str); // Only works in IE: $str = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#is', '$1>', $str); $str = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#is', '$1>', $str); $str = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#ius', '$1>', $str); // Remove namespaced elements (we do not need them) $str = preg_replace('#<!--*\w+:\w[^-->]*+>#i', '', $str); do{ // Remove really unwanted tags $old = $str; $str = preg_replace('#<!--*(?:applet|b(?:ase|gsound|link)|embed|ilayer|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^-->]*+>#i', '', $str); } while ($old !== $str); return $str; } $str = 'qwejlj<img src =x onerror=confirm(document.cookie);lol'; echo xss_clean($str);

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.0100.00617.00
8.3.50.0110.01122.18
8.3.40.0030.01619.09
8.3.30.0080.00819.09
8.3.20.0080.00020.37
8.3.10.0080.00021.91
8.3.00.0000.00919.50
8.2.180.0080.00818.54
8.2.170.0030.01322.96
8.2.160.0040.01122.27
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0090.00019.60
8.2.110.0070.00419.16
8.2.100.0080.00417.86
8.2.90.0000.00819.33
8.2.80.0080.00018.00
8.2.70.0030.00618.00
8.2.60.0060.00318.18
8.2.50.0060.00318.07
8.2.40.0030.00519.98
8.2.30.0030.00618.13
8.2.20.0030.00518.05
8.2.10.0000.00818.12
8.2.00.0040.00418.15
8.1.280.0120.00625.92
8.1.270.0070.00719.08
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0060.00324.04
8.1.230.0030.00917.73
8.1.220.0040.00418.04
8.1.210.0050.00318.77
8.1.200.0050.00917.48
8.1.190.0030.00617.36
8.1.180.0050.00318.10
8.1.170.0040.00418.84
8.1.160.0040.00422.05
8.1.150.0040.00419.02
8.1.140.0050.00317.54
8.1.130.0040.00418.08
8.1.120.0000.00817.52
8.1.110.0000.00717.54
8.1.100.0000.00717.55
8.1.90.0000.00717.59
8.1.80.0000.00717.65
8.1.70.0000.00717.59
8.1.60.0000.01017.71
8.1.50.0030.00517.63
8.1.40.0040.00417.78
8.1.30.0030.00617.80
8.1.20.0030.00517.92
8.1.10.0040.00417.73
8.1.00.0060.00617.59
8.0.300.0030.00618.77
8.0.290.0030.00617.00
8.0.280.0040.00418.50
8.0.270.0060.00317.33
8.0.260.0000.00717.31
8.0.250.0000.00717.15
8.0.240.0040.00417.26
8.0.230.0000.00717.13
8.0.220.0040.00417.17
8.0.210.0080.00017.14
8.0.200.0070.00017.17
8.0.190.0040.00417.16
8.0.180.0080.00017.17
8.0.170.0030.00617.13
8.0.160.0040.00417.05
8.0.150.0030.00616.94
8.0.140.0000.00716.96
8.0.130.0070.00013.62
8.0.120.0000.00817.04
8.0.110.0040.00417.21
8.0.100.0000.00717.13
8.0.90.0040.00417.06
8.0.80.0100.01317.06
8.0.70.0050.00317.16
8.0.60.0000.00817.14
8.0.50.0000.00817.28
8.0.30.0070.01717.50
8.0.20.0080.01117.51
8.0.10.0070.00017.11
8.0.00.0060.01117.09
7.4.330.0000.00615.33
7.4.320.0070.00016.99
7.4.300.0060.00016.83
7.4.290.0030.00516.84
7.4.280.0000.00816.95
7.4.270.0030.00316.82
7.4.260.0040.00416.93
7.4.250.0000.00916.87
7.4.240.0030.00416.96
7.4.230.0040.00416.95
7.4.220.0070.01116.81
7.4.210.0100.01317.02
7.4.200.0050.00216.97
7.4.160.0090.00616.70
7.4.150.0090.01217.40
7.4.140.0080.01217.86
7.4.130.0090.00916.79
7.4.120.0070.01016.86
7.4.110.0090.00916.77
7.4.100.0030.01416.71
7.4.90.0080.00817.09
7.4.80.0180.00019.39
7.4.70.0130.00316.77
7.4.60.0090.00916.82
7.4.50.0020.00216.85
7.4.40.0100.00716.86
7.4.30.0090.00916.86
7.4.00.0060.01215.22
7.3.330.0000.00813.52
7.3.320.0130.00013.39
7.3.310.0000.00716.48
7.3.300.0000.00716.52
7.3.290.0080.01016.58
7.3.280.0080.01016.57
7.3.270.0150.00317.40
7.3.260.0110.01516.87
7.3.250.0110.00916.79
7.3.240.0090.00916.95
7.3.230.0160.00716.79
7.3.210.0060.01016.58
7.3.200.0080.00919.39
7.3.190.0170.00016.77
7.3.180.0030.01516.81
7.3.170.0080.01516.96
7.3.160.0030.01316.71
7.3.10.0040.01116.85
7.3.00.0000.01016.99
7.2.330.0130.00416.92
7.2.320.0090.00916.93
7.2.310.0000.01816.77
7.2.300.0090.01216.85
7.2.290.0110.00716.88
7.2.130.0090.00317.00
7.2.120.0070.00317.18
7.2.110.0060.00917.11
7.2.100.0070.00417.11
7.2.90.0080.00417.23
7.2.80.0070.00717.16
7.2.70.0030.01017.16
7.2.60.0060.00617.06
7.2.50.0030.00717.23
7.2.40.0030.01317.27
7.2.30.0090.00617.27
7.2.20.0070.01017.19
7.2.10.0030.00917.17
7.2.00.0030.01118.36
7.1.250.0040.01115.79
7.1.100.0030.01018.57
7.1.70.0000.01117.44
7.1.60.0060.00917.65
7.1.50.0100.01017.36
7.1.00.0070.07322.37
7.0.200.0040.01416.93
7.0.140.0000.07722.14
7.0.60.0100.04020.11
7.0.50.0070.08717.81
7.0.40.0130.03720.21
7.0.30.0300.07020.27
7.0.20.0130.04320.14
7.0.10.0300.08020.16
7.0.00.0030.04720.12
5.6.280.0000.07720.82
5.6.210.0070.06720.77
5.6.200.0100.07718.19
5.6.190.0130.08020.48
5.6.180.0300.07720.60
5.6.170.0230.04320.50
5.6.160.0030.08020.56
5.6.150.0070.08318.17
5.6.140.0030.04318.29
5.6.130.0070.08718.23
5.6.120.0070.06721.05
5.6.110.0100.04721.15
5.6.100.0070.04321.00
5.6.90.0130.08021.14
5.6.80.0070.08020.44
5.6.70.0230.05020.40
5.5.350.4270.04020.42
5.5.340.0100.04018.09
5.5.330.0070.08320.48
5.5.320.0100.08720.32
5.5.310.0270.07320.37
5.5.300.0100.04318.03
5.5.290.0130.03018.03
5.5.280.0070.08720.89
5.5.270.0200.07320.88
5.5.260.0230.06020.89
5.5.250.0070.03720.62
5.5.240.0130.06320.30
5.4.450.0570.06719.62
5.4.440.1430.06319.71
5.4.430.0800.07719.45
5.4.420.0870.05719.61
5.4.410.0530.05719.26
5.4.400.0230.05318.88
5.4.390.0200.05718.60
5.4.380.0230.05318.54
5.4.370.0200.06018.71
5.4.360.0270.05018.82
5.4.350.0300.05318.78
5.4.340.0330.04018.58
5.4.320.0170.06318.61
5.4.310.0500.06018.71
5.4.300.1470.04718.73
5.4.290.0170.05318.76
5.4.280.0200.06018.73
5.4.270.0200.05018.75
5.4.260.0230.05018.77
5.4.250.0200.05718.79
5.4.240.0230.05018.54
5.4.230.0230.05718.74
5.4.220.0130.05718.62
5.4.210.0230.05018.78
5.4.200.0200.05016.57
5.4.190.0270.05018.60
5.4.180.0130.06718.58
5.4.170.0230.05318.69
5.4.160.0170.05718.49
5.4.150.0270.05018.46
5.4.140.1530.06716.47
5.4.130.0130.05716.31
5.4.120.0200.07016.45
5.4.110.0230.06316.18
5.4.100.2400.07716.30
5.4.90.0170.07716.28
5.4.80.0500.06316.34
5.4.70.0300.05016.40
5.4.60.0370.06316.44
5.4.50.0300.04716.23
5.4.40.0270.05316.31
5.4.30.0270.05016.32
5.4.20.0230.05316.20
5.4.10.0270.05016.27
5.4.00.0230.05315.68
5.3.290.0200.06314.88
5.3.280.0300.05714.61
5.3.270.0300.05714.71
5.3.260.0270.06014.64
5.3.250.0230.05314.71
5.3.240.0200.05714.73
5.3.230.0270.05314.67
5.3.220.0130.05714.63
5.3.210.0170.05714.63
5.3.200.0330.06314.76
5.3.190.0270.07014.80
5.3.180.0170.06014.64
5.3.170.0230.05014.57
5.3.160.0300.04314.64
5.3.150.0270.05714.70
5.3.140.0300.06014.80
5.3.130.0330.05014.56
5.3.120.0330.06714.62
5.3.110.0400.04014.56
5.3.100.0270.05314.09
5.3.90.0200.05314.02
5.3.80.0200.06014.20
5.3.70.0170.06714.09
5.3.60.0130.07014.04
5.3.50.0170.05313.95
5.3.40.0330.05714.02
5.3.30.0370.03714.16
5.3.20.0230.05013.84
5.3.10.0230.04713.84
5.3.00.0300.06013.82
5.2.170.0270.03711.28
5.2.160.0200.04311.22
5.2.150.0200.05711.21
5.2.140.0170.06011.23
5.2.130.0130.04711.19
5.2.120.0130.04311.34
5.2.110.0100.04711.22
5.2.100.0270.03011.22
5.2.90.0230.04011.25
5.2.80.0100.05011.24
5.2.70.0370.03711.25
5.2.60.0200.04011.16
5.2.50.0200.04711.16
5.2.40.0170.04011.14
5.2.30.0100.05011.13
5.2.20.0130.06011.02
5.2.10.0200.04010.93
5.2.00.0200.05310.73
5.1.60.0200.04710.00
5.1.50.0170.04710.11
5.1.40.0230.02710.13
5.1.30.0130.04310.39
5.1.20.0130.04310.46
5.1.10.0130.04010.21
5.1.00.0130.03710.09
5.0.50.0130.0278.62
5.0.40.0130.0278.47
5.0.30.0130.0408.23
5.0.20.0070.0338.26
5.0.10.0100.0378.40
5.0.00.0170.0408.17
4.4.90.0100.0305.94
4.4.80.0130.0306.02
4.4.70.0000.0306.02
4.4.60.0130.0235.94
4.4.50.0100.0205.92
4.4.40.0070.0475.91
4.4.30.0100.0276.00
4.4.20.0100.0206.06
4.4.10.0070.0235.96
4.4.00.0130.0305.98
4.3.110.0070.0275.93
4.3.100.0070.0235.85
4.3.90.0130.0175.89
4.3.80.0100.0335.95
4.3.70.0070.0235.82
4.3.60.0200.0175.81
4.3.50.0030.0275.81
4.3.40.0070.0375.89
4.3.30.0030.0274.58
4.3.20.0100.0204.70
4.3.10.0070.0204.48
4.3.00.0130.0277.15

preferences:
41.27 ms | 401 KiB | 5 Q