3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unicode2utf8($c){ $output=""; if($c < 0x80) { return chr($c); } else if($c < 0x800) { return chr( 0xc0 | ($c >> 6) ).chr( 0x80 | ($c & 0x3f) ); } else if($c < 0x10000) { return chr( 0xe0 | ($c >> 12) ).chr( 0x80 | (($c >> 6) & 0x3f) ).chr( 0x80 | ($c & 0x3f) ); } else if($c < 0x200000) { return chr(0xf0 | ($c >> 18)).chr(0x80 | (($c >> 12) & 0x3f)).chr(0x80 | (($c >> 6) & 0x3f)).chr(0x80 | ($c & 0x3f)); } return false; } function sanitizeFileName( $name ) { $invalidCharacters = array("\x2f", "\x22", "\x2a", "\x3a", "\x3c", "\x3e", "\x3f", "\x5c", "\x7f"); $name = str_replace($invalidCharacters, '', $name); var_dump('ddd - '.$name); $name = preg_replace('/[\x{0000}-\x{001F}\x{0080}-\x{009F}\x{E000}-\x{F8FF}\x{FDD0}-\x{FDEF}\x{FFF0}-\x{FFFF}]/u', '', $name); return $name; } $str = "blablabla ǹéñ~# - ".unicode2utf8(0xE001).' - '.unicode2utf8(0xFDD3).' - '.unicode2utf8(0xFD00); var_dump($str); var_dump(sanitizeFileName($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.0070.00718.43
8.3.50.0080.01021.21
8.3.40.0060.01619.09
8.3.30.0110.00419.01
8.3.20.0000.00918.89
8.3.10.0070.00020.79
8.3.00.0070.00023.66
8.2.180.0090.00616.63
8.2.170.0150.00622.96
8.2.160.0130.00320.37
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00421.02
8.2.110.0030.00720.52
8.2.100.0080.00417.97
8.2.90.0000.00819.14
8.2.80.0000.00817.97
8.2.70.0100.00317.50
8.2.60.0000.00817.80
8.2.50.0000.00818.07
8.2.40.0000.00818.16
8.2.30.0050.00319.75
8.2.20.0060.00317.99
8.2.10.0040.00417.94
8.2.00.0070.00417.98
8.1.280.0110.00425.92
8.1.270.0080.00023.99
8.1.260.0130.00726.35
8.1.250.0060.00328.09
8.1.240.0000.00822.59
8.1.230.0000.01120.97
8.1.220.0040.00418.77
8.1.210.0050.00519.08
8.1.200.0040.00817.60
8.1.190.0000.00817.52
8.1.180.0090.00318.10
8.1.170.0060.00318.75
8.1.160.0050.00519.00
8.1.150.0040.00418.73
8.1.140.0000.00817.68
8.1.130.0000.00817.94
8.1.120.0040.00417.57
8.1.110.0030.00517.56
8.1.100.0000.00817.56
8.1.90.0020.00517.66
8.1.80.0040.00417.65
8.1.70.0000.00717.58
8.1.60.0040.00717.78
8.1.50.0000.00817.66
8.1.40.0040.00417.61
8.1.30.0060.00317.83
8.1.20.0000.00817.70
8.1.10.0080.00017.77
8.1.00.0050.00217.68
8.0.300.0040.00420.16
8.0.290.0070.00017.17
8.0.280.0080.00018.55
8.0.270.0060.00317.33
8.0.260.0040.00417.04
8.0.250.0070.00017.10
8.0.240.0000.00917.24
8.0.230.0000.00717.17
8.0.220.0030.00317.11
8.0.210.0050.00317.07
8.0.200.0000.00717.10
8.0.190.0000.00717.10
8.0.180.0070.00017.06
8.0.170.0000.00817.17
8.0.160.0000.00717.23
8.0.150.0040.00417.14
8.0.140.0060.00317.13
8.0.130.0000.00613.56
8.0.120.0030.00617.17
8.0.110.0040.00416.93
8.0.100.0070.00017.04
8.0.90.0070.00016.93
8.0.80.0120.00417.18
8.0.70.0000.00717.00
8.0.60.0050.00317.21
8.0.50.0040.00417.13
8.0.30.0090.01217.16
8.0.20.0150.00417.40
8.0.10.0000.00816.96
8.0.00.0100.01017.00
7.4.330.0030.00314.99
7.4.320.0000.00616.70
7.4.300.0000.00616.65
7.4.290.0050.00216.76
7.4.280.0040.00416.75
7.4.270.0030.00316.76
7.4.260.0000.00513.48
7.4.250.0080.00016.68
7.4.240.0000.00816.65
7.4.230.0030.00316.86
7.4.220.0060.00916.82
7.4.210.0080.01016.83
7.4.200.0030.00316.70
7.4.190.0070.00016.94
7.4.160.0120.00416.89
7.4.150.0140.00317.40
7.4.140.0080.01317.86
7.4.130.0130.01016.67
7.4.120.0170.00416.82
7.4.110.0090.00916.81
7.4.100.0070.01416.86
7.4.90.0160.01016.69
7.4.80.0130.00919.37
7.4.70.0100.00716.64
7.4.60.0120.00416.75
7.4.50.0030.00616.64
7.4.40.0030.01322.27
7.4.30.0100.00916.68
7.4.00.0100.00715.14
7.3.330.0050.00013.34
7.3.320.0000.00613.51
7.3.310.0000.00716.53
7.3.300.0000.00716.51
7.3.290.0030.01216.52
7.3.280.0050.01116.55
7.3.270.0030.01417.40
7.3.260.0090.01018.24
7.3.250.0090.00916.57
7.3.240.0070.01416.71
7.3.230.0150.00616.84
7.3.210.0100.00716.70
7.3.200.0090.01219.39
7.3.190.0080.00816.75
7.3.180.0080.00816.61
7.3.170.0110.00516.54
7.3.160.0060.00916.40
7.3.120.0040.01114.98
7.3.110.0030.01314.83
7.3.100.0030.01215.21
7.3.90.0080.00315.04
7.3.80.0030.00615.23
7.3.70.0000.01015.16
7.3.60.0060.00615.04
7.3.50.0130.00015.17
7.3.40.0060.00314.87
7.3.30.0080.00414.87
7.3.20.0030.01217.06
7.3.10.0040.01116.84
7.3.00.0030.01116.71
7.2.330.0130.00616.82
7.2.320.0120.00816.89
7.2.310.0130.01216.83
7.2.300.0100.00616.82
7.2.290.0090.00916.75
7.2.240.0060.00615.30
7.2.230.0040.01515.36
7.2.220.0070.01015.13
7.2.210.0070.01115.00
7.2.200.0070.00715.30
7.2.190.0090.00615.02
7.2.180.0030.01315.17
7.2.170.0090.00614.94
7.2.160.0070.00715.25
7.2.150.0130.00317.29
7.2.140.0030.00916.77
7.2.130.0060.00617.07
7.2.120.0060.00617.14
7.2.110.0000.01317.21
7.2.100.0080.00817.09
7.2.90.0110.00317.13
7.2.80.0100.00317.21
7.2.70.0100.00317.07
7.2.60.0120.00616.86
7.2.50.0030.01116.90
7.2.40.0000.01517.06
7.2.30.0030.01016.89
7.2.20.0000.01517.11
7.2.10.0060.00917.06
7.2.00.0080.00818.29
7.1.330.0030.01416.06
7.1.320.0040.01216.01
7.1.310.0030.00715.57
7.1.300.0040.00916.14
7.1.290.0100.00315.90
7.1.280.0030.01016.11
7.1.270.0040.01115.96
7.1.260.0040.01115.98
7.1.250.0060.00615.91
7.1.100.0000.01418.23
7.1.70.0040.00417.48
7.1.60.0030.02019.40
7.1.50.0190.01217.11
7.1.00.0000.06722.45
7.0.200.0090.00316.66
7.0.140.0070.07022.12
7.0.70.0030.08021.54
7.0.60.0000.06721.67
7.0.50.0030.09022.09
7.0.40.0070.07320.06
7.0.30.0000.08020.01
7.0.20.0030.04720.09
7.0.10.0030.05319.93
7.0.00.0000.04319.87
5.6.220.0100.07320.61
5.6.210.0170.06720.55
5.6.200.0070.08720.97
5.6.190.0070.08020.99
5.6.180.0030.07320.98
5.6.170.0000.06321.09
5.6.160.0000.05020.96
5.6.150.0030.04320.93
5.6.140.0000.04321.04
5.6.130.0000.04320.85
5.6.120.0100.05721.04
5.6.110.0000.05021.02
5.6.100.0100.07320.79
5.6.90.0030.08720.96
5.6.80.0030.04720.41
5.6.70.0030.07020.31
5.6.60.0000.08320.41
5.6.50.0000.08320.42
5.6.40.0030.05020.29
5.6.30.0070.07320.38
5.6.20.0030.07720.22
5.6.10.0070.07720.29
5.6.00.0070.07020.27
5.5.360.0000.08020.30
5.5.350.0130.07020.20
5.5.340.0030.08020.87
5.5.330.0100.07720.73
5.5.320.0030.10020.68
5.5.310.0070.07320.84
5.5.300.0030.04020.78
5.5.290.0030.04320.77
5.5.280.0000.09020.83
5.5.270.0000.05020.81
5.5.260.0070.06720.77
5.5.250.0000.08720.50
5.5.240.0070.07720.22
5.5.230.0130.07320.20
5.5.220.0000.07720.16
5.5.210.0030.06719.99
5.5.200.0030.06020.15
5.5.190.0030.08320.11
5.5.180.0070.08020.01
5.5.160.0070.07320.08
5.5.150.0100.06720.00
5.5.140.0030.07019.96
5.5.130.0100.07020.20
5.5.120.0030.06019.96
5.5.110.0070.07320.14
5.5.100.0000.04019.99
5.5.90.0070.03320.07
5.5.80.0030.04720.07
5.5.70.0000.04719.96
5.5.60.0030.08020.03
5.5.50.0000.05020.08
5.5.40.0000.05320.00
5.5.30.0000.07319.95
5.5.20.0030.08020.08
5.5.10.0130.06319.98
5.5.00.0000.07719.94
5.4.450.0030.04019.30
5.4.440.0030.08319.09
5.4.430.0030.07319.06
5.4.420.0100.05719.43
5.4.410.0030.05318.96
5.4.400.0000.07318.96
5.4.390.0030.07719.04
5.4.380.0000.08018.96
5.4.370.0030.07318.82
5.4.360.0070.06319.07
5.4.350.0070.06718.85
5.4.340.0070.08019.03
5.4.320.0000.07718.96
5.4.310.0200.06019.11
5.4.300.0070.06318.77
5.4.290.0030.07719.09
5.4.280.0000.06718.81
5.4.270.0070.07019.07
5.4.260.0030.05019.04
5.4.250.0030.07019.08
5.4.240.0070.06319.13
5.4.230.0000.04718.81
5.4.220.0070.04318.82
5.4.210.0000.07318.76
5.4.200.0070.03718.86
5.4.190.0000.04718.80
5.4.180.0030.07719.07
5.4.170.0070.07018.95
5.4.160.0030.07319.05
5.4.150.0070.07718.74
5.4.140.0000.06316.30
5.4.130.0070.06016.34
5.4.120.0070.06316.30
5.4.110.0030.05716.34
5.4.100.0070.07316.44
5.4.90.0070.06316.37
5.4.80.0070.04716.27
5.4.70.0030.05316.30
5.4.60.0030.07016.16
5.4.50.0030.03716.36
5.4.40.0000.03716.43
5.4.30.0070.03716.26
5.4.20.0030.04716.35
5.4.10.0030.03316.41
5.4.00.0000.03315.73
5.3.290.0030.06314.75
5.3.280.0030.07014.61
5.3.270.0070.07314.54
5.3.260.0000.07014.61
5.3.250.0030.07014.49
5.3.240.0070.06314.60
5.3.230.0000.05014.53
5.3.220.0070.06714.71
5.3.210.0070.06014.56
5.3.200.0100.04314.66
5.3.190.0030.07714.68
5.3.180.0100.07014.55
5.3.170.0070.06714.49
5.3.160.0030.07314.57
5.3.150.0000.05314.46
5.3.140.0000.03714.45
5.3.130.0000.05014.44
5.3.120.0070.05714.55
5.3.110.0030.03714.46
5.3.100.0070.03714.04
5.3.90.0030.03313.95
5.3.80.0030.03313.90
5.3.70.0000.03714.02
5.3.60.0000.03713.99
5.3.50.0030.05013.85
5.3.40.0000.04313.82
5.3.30.0070.06013.90
5.3.20.0000.07013.69
5.3.10.0030.05713.66
5.3.00.0070.07013.62
5.2.170.0000.04311.16
5.2.160.0000.04011.29
5.2.150.0070.02311.22
5.2.140.0000.04711.02
5.2.130.0030.06011.13
5.2.120.0000.06311.09
5.2.110.0030.05711.11
5.2.100.0000.06010.98
5.2.90.0030.04011.21
5.2.80.0000.06711.10
5.2.70.0070.05011.02
5.2.60.0030.03311.05
5.2.50.0070.03011.11
5.2.40.0000.03311.09
5.2.30.0000.04310.86
5.2.20.0030.03011.00
5.2.10.0070.03310.88
5.2.00.0030.06310.63
5.1.60.0070.03710.37
5.1.50.0000.02310.37
5.1.40.0000.02310.37
5.1.30.0030.02310.37
5.1.20.0000.02710.37
5.1.10.0070.04010.37
5.1.00.0030.04710.37
5.0.50.0030.04010.37
5.0.40.0000.04710.37
5.0.30.0070.05310.37
5.0.20.0070.03710.37
5.0.10.0000.04310.37
5.0.00.0000.06310.37
4.4.90.0000.02310.37
4.4.80.0000.02010.37
4.4.70.0000.03010.37
4.4.60.0030.03010.37
4.4.50.0030.02710.37
4.4.40.0030.02710.37
4.4.30.0000.01310.37
4.4.20.0030.03710.37
4.4.10.0030.03710.37
4.4.00.0030.04310.37
4.3.110.0000.03710.37
4.3.100.0070.03010.37
4.3.90.0030.03310.37
4.3.80.0000.05010.37
4.3.70.0030.02310.37
4.3.60.0000.03010.37
4.3.50.0000.02710.37
4.3.40.0000.04710.37
4.3.30.0030.03710.37
4.3.20.0000.03710.37
4.3.10.0000.03310.37
4.3.00.0000.04010.37

preferences:
67.11 ms | 404 KiB | 6 Q