3v4l.org

run code in 300+ PHP versions simultaneously
<? function filter_input_utf8($type, $default = array()) { static $is_recursive_static = false; $is_recursive = $is_recursive_static; if (!$is_recursive_static) { $types = array( INPUT_GET => $_GET, INPUT_POST => $_POST, INPUT_COOKIE => $_COOKIE, INPUT_REQUEST => $_REQUEST, INPUT_ENV => $_ENV, INPUT_SERVER => $_SERVER, ); if (!isset($types[$type])) { return $default; } $var = $types[$type]; $is_recursive_static = true; } else { $var = $type; } $ret = array(); foreach ((array)$default as $key => $value) { if (!isset($var[$key])) { $ret[$key] = $value; } elseif (is_array($value)) { $ret[$key] = filter_input_utf8($var[$key], $value); } elseif (is_array($var[$key]) || !preg_match('//u', $var)) { $ret[$key] = $value; } else { $ret[$key] = $var[$key]; } } if (!$is_recursive) { $is_recursive_static = false; } return $ret; } $_POST = array( 'a' => array( 'b' => 'Invalid Data', ), 'c' => array( 'd' => 'Valid Data', ), 'e' => 'Valid Data', 'f' => 'Unneeded Data', ); $post = filter_input_utf8($_POST, array( 'a' => null, 'c' => array( 'd' => null, ), 'e' => null, )); var_dump($post);

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.01016.63
8.3.50.0120.00817.41
8.3.40.0100.00718.44
8.3.30.0120.00318.47
8.3.20.0070.00018.64
8.3.10.0030.00518.79
8.3.00.0030.00619.01
8.2.180.0120.00616.63
8.2.170.0070.01122.96
8.2.160.0120.00320.89
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0080.00020.75
8.2.110.0070.00321.06
8.2.100.0060.00617.72
8.2.90.0030.00719.39
8.2.80.0040.00419.21
8.2.70.0040.00417.38
8.2.60.0080.00317.55
8.2.50.0050.00318.07
8.2.40.0030.00518.09
8.2.30.0000.00718.02
8.2.20.0030.00617.64
8.2.10.0000.00817.43
8.2.00.0080.00017.43
8.1.280.0160.00325.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00923.95
8.1.230.0080.00420.87
8.1.220.0080.00017.74
8.1.210.0060.00318.92
8.1.200.0060.00317.23
8.1.190.0070.00017.39
8.1.180.0030.00618.10
8.1.170.0050.00518.84
8.1.160.0040.00418.76
8.1.150.0040.00418.54
8.1.140.0040.00417.27
8.1.130.0030.00317.75
8.1.120.0070.00017.30
8.1.110.0030.00517.30
8.1.100.0000.00717.21
8.1.90.0050.00317.23
8.1.80.0000.00717.31
8.1.70.0030.00317.31
8.1.60.0050.00317.43
8.1.50.0040.00417.29
8.1.40.0040.00417.34
8.1.30.0060.00317.43
8.1.20.0000.00717.42
8.1.10.0000.00817.45
8.1.00.0070.00417.38
8.0.300.0090.00019.95
8.0.290.0080.00016.58
8.0.280.0000.00718.39
8.0.270.0030.00317.10
8.0.260.0060.00016.74
8.0.250.0000.00716.87
8.0.240.0030.00516.68
8.0.230.0000.00716.82
8.0.220.0030.00516.73
8.0.210.0070.00016.74
8.0.200.0030.00316.82
8.0.190.0030.00316.86
8.0.180.0040.00416.77
8.0.170.0030.00616.66
8.0.160.0050.00216.73
8.0.150.0030.00616.60
8.0.140.0000.00916.62
8.0.130.0060.00013.38
8.0.120.0000.00816.63
8.0.110.0070.00016.59
8.0.100.0080.00016.63
8.0.90.0040.00416.64
8.0.80.0070.00716.80
8.0.70.0040.00416.79
8.0.60.0000.00716.72
8.0.50.0040.00416.61
8.0.30.0040.01417.05
8.0.20.0040.01417.08
8.0.10.0070.00016.83
8.0.00.0090.01016.60
7.4.330.0000.00513.03
7.4.320.0070.00016.38
7.4.300.0060.00016.49
7.4.290.0030.00316.51
7.4.280.0040.00416.36
7.4.270.0030.00516.27
7.4.260.0000.00513.26
7.4.250.0030.00616.26
7.4.240.0030.00416.35
7.4.230.0000.00716.50
7.4.220.0130.00916.34
7.4.210.0070.00916.36
7.4.200.0000.00716.12
7.4.190.0000.00816.62
7.4.160.0080.00816.45
7.4.150.0140.00316.49
7.4.140.0090.00916.25
7.4.130.0060.01016.30
7.4.120.0090.00816.50
7.4.110.0100.00616.60
7.4.100.0060.01216.35
7.4.90.0100.00716.27
7.4.80.0040.01219.39
7.4.70.0070.01016.35
7.4.60.0060.00916.36
7.4.50.0080.00416.42
7.4.40.0120.00316.27
7.4.30.0030.01216.47
7.4.00.0070.00714.93
7.3.330.0060.00013.51
7.3.320.0050.00013.28
7.3.310.0030.00315.98
7.3.300.0030.00316.13
7.3.290.0100.01016.14
7.3.280.0040.01416.17
7.3.270.0030.01416.52
7.3.260.0100.00616.38
7.3.250.0110.00616.26
7.3.240.0100.00716.33
7.3.230.0030.01416.13
7.3.210.0060.00916.23
7.3.200.0070.01016.49
7.3.190.0150.00616.37
7.3.180.0040.01216.24
7.3.170.0110.00616.38
7.3.160.0220.00016.35
7.3.120.0030.01314.93
7.3.10.0040.00816.70
7.3.00.0070.00716.69
7.2.330.0090.00916.53
7.2.320.0140.00316.55
7.2.310.0100.00716.54
7.2.300.0040.01116.22
7.2.290.0130.00316.58
7.2.130.0110.00316.70
7.2.120.0070.00416.77
7.2.110.0070.00716.89
7.2.100.0150.00016.93
7.2.90.0120.00317.07
7.2.80.0030.01017.01
7.2.70.0120.00316.83
7.2.60.0040.01116.88
7.2.50.0040.00816.67
7.2.40.0040.01116.94
7.2.30.0040.01116.85
7.2.20.0000.01116.72
7.2.10.0070.00716.90
7.2.00.0050.00818.04
7.1.250.0030.00815.82
7.1.100.0140.01018.15
7.1.70.0080.00017.15
7.1.60.0070.01819.40
7.1.50.0000.01917.05
7.1.00.0130.06022.32
7.0.200.0220.00314.60
7.0.140.0030.07721.92
7.0.120.0030.07022.09
7.0.60.0170.06319.88
7.0.50.0100.07317.83
7.0.40.0100.04320.18
7.0.30.0170.06720.24
7.0.20.0200.04720.20
7.0.10.0100.05720.09
7.0.00.0070.04020.30
5.6.210.0070.03720.64
5.6.200.0170.08018.18
5.6.190.0070.05020.55
5.6.180.0430.05320.61
5.6.170.0330.06320.71
5.6.160.0070.04020.59
5.6.150.0030.04318.28
5.6.140.0000.06018.30
5.6.130.0070.07018.18
5.6.120.0170.06721.02
5.6.110.0070.06321.16
5.6.100.0030.07021.14
5.6.90.0030.04021.13
5.6.80.0000.05020.30
5.5.350.0330.08320.35
5.5.340.0070.07718.09
5.5.330.0070.07720.21
5.5.320.0370.07720.24
5.5.310.0300.08020.34
5.5.300.0070.08317.93
5.5.290.0000.05318.08
5.5.280.0170.07720.91
5.5.270.0070.08020.73
5.5.260.0030.06320.97
5.5.250.0100.04020.65
5.5.240.0070.08020.39
5.4.450.0070.08019.25
5.4.440.0030.08719.18
5.4.430.0170.06719.19
5.4.420.0100.07319.48
5.4.410.0030.07719.11
5.4.400.0070.07018.86
5.4.390.0030.07319.17
5.4.380.0000.05019.14
5.4.370.0000.04318.85
5.4.360.0170.06019.26
5.4.350.0070.07718.97
5.4.340.0170.06718.85
5.4.320.0130.03319.25
5.4.310.0200.06719.08
5.4.300.0100.03718.95
5.4.290.0000.04318.95
5.4.280.0030.04719.14
5.4.270.0030.05719.15
5.4.260.0070.04318.87
5.4.250.0100.07318.86
5.4.240.0030.08019.00
5.4.230.0070.06319.24
5.4.220.0100.07019.23
5.4.210.0000.08319.21
5.4.200.0100.04019.16
5.4.190.0300.05319.14
5.4.180.0000.05019.15
5.4.170.0030.07719.13
5.4.160.0070.04718.83
5.4.150.0100.07719.06
5.4.140.0030.04016.51
5.4.130.0030.07316.34
5.4.120.0130.06016.30
5.4.110.0100.06716.41
5.4.100.0030.07716.54
5.4.90.0100.03716.43
5.4.80.0100.07316.65
5.4.70.0030.07716.39
5.4.60.0000.08016.43
5.4.50.0030.04016.36
5.4.40.0070.06316.46
5.4.30.0130.04016.35
5.4.20.0100.04716.35
5.4.10.0000.05716.46
5.4.00.0000.07015.79
5.3.290.0170.05714.59
5.3.280.0100.03714.51
5.3.270.0070.08014.52
5.3.260.0070.05014.56
5.3.250.0100.08014.50
5.3.240.0070.06714.48
5.3.230.0030.08314.57
5.3.220.0070.05314.54
5.3.210.0070.06714.50
5.3.200.0070.05014.54
5.3.190.0070.08014.53
5.3.180.0030.05314.48
5.3.170.0070.07714.35
5.3.160.0170.07014.49
5.3.150.0070.07014.50
5.3.140.0000.04014.37
5.3.130.0000.06014.46
5.3.120.0170.06314.47
5.3.110.0100.06714.42
5.3.100.0070.06014.04
5.3.90.0070.04313.98
5.3.80.0000.06713.95
5.3.70.0170.04313.85
5.3.60.0000.05314.02
5.3.50.0070.05013.76
5.3.40.0000.08313.87
5.3.30.0070.07013.74
5.3.20.0130.05713.61
5.3.10.0030.04713.75
5.3.00.0000.07013.60
5.2.170.0070.06011.02
5.2.160.0070.05011.15
5.2.150.0030.04311.07
5.2.140.0000.06711.22
5.2.130.0030.04311.03
5.2.120.0000.04711.25
5.2.110.0100.03011.06
5.2.100.0000.04311.00
5.2.90.0070.06011.04
5.2.80.0070.05711.03
5.2.70.0030.06311.17
5.2.60.0070.05011.04
5.2.50.0100.04310.95
5.2.40.0000.06310.93
5.2.30.0030.06310.79
5.2.20.0130.06010.94
5.2.10.0000.06010.85
5.2.00.0000.03310.79
5.1.60.0100.0409.89
5.1.50.0070.0439.97
5.1.40.0030.0509.98
5.1.30.0000.05310.37
5.1.20.0030.05710.33
5.1.10.0000.03010.07
5.1.00.0030.05710.07
5.0.50.0030.0238.49
5.0.40.0030.0238.31
5.0.30.0070.0438.21
5.0.20.0000.0478.20
5.0.10.0030.0378.32
5.0.00.0030.0378.30
4.4.90.0000.0377.74
4.4.80.0070.0337.74
4.4.70.0030.0337.74
4.4.60.0000.0377.74
4.4.50.0100.0307.74
4.4.40.0030.0337.74
4.4.30.0000.0407.74
4.4.20.0070.0307.74
4.4.10.0000.0177.74
4.4.00.0030.0507.74
4.3.110.0030.0337.74
4.3.100.0000.0307.74
4.3.90.0070.0307.74
4.3.80.0000.0537.74
4.3.70.0030.0337.74
4.3.60.0100.0237.74
4.3.50.0000.0307.74
4.3.40.0070.0337.74
4.3.30.0000.0207.74
4.3.20.0000.0407.74
4.3.10.0000.0377.74
4.3.00.0000.0377.74

preferences:
47.54 ms | 400 KiB | 5 Q