3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Sanitizer { public function sanitizeSingle(&$string) { if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) { $string = stripslashes($string); } $string = trim(htmlspecialchars($string, ENT_QUOTES)); } public function sanitize($data) { if (is_array($data)) { array_walk_recursive($data, [$this, 'sanitizeSingle']); } else { $this->sanitizeSingle($data); } return $data; } } $array = ['one' => ['a ', ' b ', ' c'], 'two' => " <a href='test'>Test</a>"]; $string = ' another "test"'; $sanitizer = new Sanitizer(); var_export($sanitizer->sanitize($array)); echo "\n---\n"; var_export($sanitizer->sanitize($string));

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.130.0040.00518.56
8.4.120.0050.00424.08
8.4.110.0110.01018.85
8.4.100.0090.00918.83
8.4.90.0100.01020.49
8.4.80.0130.00618.85
8.4.70.0080.00418.80
8.4.60.0150.00519.00
8.4.50.0110.00818.91
8.4.40.0040.01218.55
8.4.30.0160.00318.67
8.4.20.0130.00617.71
8.4.10.0120.00319.27
8.3.260.0140.00616.59
8.3.250.0100.00617.13
8.3.240.0110.00717.28
8.3.230.0140.00516.37
8.3.220.0050.00318.89
8.3.210.0140.00416.41
8.3.200.0040.00416.45
8.3.190.0080.00717.10
8.3.180.0060.00418.78
8.3.170.0040.00421.07
8.3.160.0090.00917.16
8.3.150.0100.01017.23
8.3.140.0060.00318.80
8.3.130.0070.00316.61
8.3.120.0080.00020.77
8.3.110.0040.00720.94
8.3.100.0070.00324.06
8.3.90.0100.00026.77
8.3.80.0040.00419.36
8.3.70.0030.01216.58
8.3.60.0090.00918.31
8.3.50.0150.00524.43
8.3.40.0140.00321.77
8.3.30.0060.01018.67
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0100.00720.44
8.2.280.0070.00318.30
8.2.270.0110.00419.85
8.2.260.0100.00716.57
8.2.250.0090.00016.55
8.2.240.0030.00619.04
8.2.230.0080.00022.58
8.2.220.0030.00637.54
8.2.210.0120.00626.77
8.2.200.0070.00318.88
8.2.190.0150.00416.58
8.2.180.0040.01125.92
8.2.170.0110.00718.69
8.2.160.0130.01022.96
8.2.150.0070.00025.66
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0030.00721.09
8.2.110.0030.00720.47
8.2.100.0000.01317.91
8.2.90.0080.00019.64
8.2.80.0050.00317.97
8.2.70.0040.00817.90
8.2.60.0050.00317.91
8.2.50.0040.00718.10
8.2.40.0040.00419.20
8.2.30.0050.00219.31
8.2.20.0040.00418.00
8.2.10.0040.00419.31
8.2.00.0040.00419.33
8.1.330.0110.00622.04
8.1.320.0120.00916.20
8.1.310.0040.01417.64
8.1.300.0080.00820.14
8.1.290.0090.00030.84
8.1.280.0120.00325.92
8.1.270.0050.00323.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00323.92
8.1.230.0040.00722.82
8.1.220.0020.00517.78
8.1.210.0040.00418.77
8.1.200.0030.00617.25
8.1.190.0030.00517.23
8.1.180.0000.00818.10
8.1.170.0050.00318.62
8.1.160.0040.00419.01
8.1.150.0040.00418.95
8.1.140.0060.00320.73
8.1.130.0050.00220.12
8.1.120.0060.00317.46
8.1.110.0090.00017.47
8.1.100.0030.00617.39
8.1.90.0040.00417.38
8.1.80.0070.00317.46
8.1.70.0000.00717.48
8.1.60.0030.00617.59
8.1.50.0060.00317.54
8.1.40.0000.00917.57
8.1.30.0040.00417.55
8.1.20.0090.00417.56
8.1.10.0040.00417.46
8.1.00.0020.00517.55
8.0.300.0030.00621.64
8.0.290.0080.00016.75
8.0.280.0000.00718.45
8.0.270.0040.00416.74
8.0.260.0030.00318.50
8.0.250.0040.00416.95
8.0.240.0080.00017.02
8.0.230.0030.00316.92
8.0.220.0000.00816.89
8.0.210.0040.00416.75
8.0.200.0000.00716.91
8.0.190.0080.00016.86
8.0.180.0050.00216.86
8.0.170.0030.00616.90
8.0.160.0000.00816.86
8.0.150.0040.00416.80
8.0.140.0070.00016.88
8.0.130.0030.00313.35
8.0.120.0000.00716.81
8.0.110.0040.00416.76
8.0.100.0030.00516.66
8.0.90.0000.00716.95
8.0.80.0110.00816.91
8.0.70.0000.00816.77
8.0.60.0040.00416.84
8.0.50.0020.00516.91
8.0.30.0140.00517.04
8.0.20.0110.00817.17
8.0.10.0000.00717.08
8.0.00.0070.01316.98
7.4.330.0040.00015.55
7.4.320.0030.00316.49
7.4.300.0030.00316.51
7.4.290.0020.00516.51
7.4.280.0070.00416.44
7.4.270.0070.00016.49
7.4.260.0030.00313.25
7.4.250.0000.01016.51
7.4.240.0030.00316.50
7.4.230.0000.00716.62
7.4.220.0030.00316.65
7.4.210.0010.01316.58
7.4.200.0040.00416.32
7.4.130.0100.01316.59
7.4.120.0220.01116.50
7.4.110.0220.01016.38
7.4.100.0230.00916.52
7.4.90.0210.01216.44
7.4.80.0120.02316.76
7.4.70.0290.00616.59
7.4.60.0260.00816.45
7.4.50.0200.01716.35
7.4.40.0190.01216.63
7.4.30.0300.00516.45
7.4.20.0180.01416.44
7.4.10.0320.00016.62
7.4.00.0200.00316.54
7.3.330.0040.00416.39
7.3.320.0000.00613.22
7.3.310.0080.00016.20
7.3.300.0000.00616.10
7.3.290.0050.01116.24
7.3.260.0070.01316.43
7.3.240.0400.01116.51
7.3.230.0220.01516.29
7.3.220.0230.01016.50
7.3.210.0270.01016.27
7.3.200.0250.01216.23
7.3.190.0230.01516.46
7.3.180.0220.01216.25
7.3.170.0290.00416.39
7.3.160.0230.01216.50
7.3.150.0220.01316.44
7.3.140.0190.01516.28
7.3.130.0130.02216.34
7.3.120.0220.01016.29
7.3.110.0250.01016.49
7.3.100.0330.00016.45
7.3.90.0310.00916.23
7.3.80.0250.01016.29
7.3.70.0140.01716.36
7.3.60.0170.01416.40
7.3.50.0330.00916.17
7.3.40.0350.00016.26
7.3.30.0270.01016.30
7.3.20.0330.00316.46
7.3.10.0230.01016.47
7.3.00.0330.00416.23
7.2.340.0090.00916.66
7.2.330.0260.00316.50
7.2.320.0230.00916.80
7.2.310.0260.00916.72
7.2.300.0250.00616.58
7.2.290.0230.01016.68
7.2.280.0180.01516.47
7.2.270.0290.00616.56
7.2.260.0260.01016.80
7.2.250.0260.00616.52
7.2.240.0280.00616.74
7.2.230.0250.01316.77
7.2.220.0230.01116.78
7.2.210.0360.00016.57
7.2.200.0260.01316.62
7.2.190.0290.00516.52
7.2.180.0220.00916.64
7.2.170.0240.01216.75
7.2.160.0260.01216.64
7.2.150.0230.01316.57
7.2.140.0190.01216.78
7.2.130.0280.00716.57
7.2.120.0260.01616.62
7.2.110.0270.00916.70
7.2.100.0270.01216.68
7.2.90.0250.01116.59
7.2.80.0380.00016.63
7.2.70.0200.01716.77
7.2.60.0250.00616.65
7.2.50.0280.01016.71
7.2.40.0220.01516.80
7.2.30.0330.00616.84
7.2.20.0260.01516.71
7.2.10.0340.00416.75
7.2.00.0440.00616.52

preferences:
27.37 ms | 403 KiB | 5 Q