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); $name = preg_replace('/[\x{0000}-\x{001F}]/', '', $name); var_dump('1 '.$name); $name = preg_replace('/[\x{0080}-\x{009F}]/', '', $name); var_dump('2 '.$name); $name = preg_replace('/[\x{E000}-\x{F8FF}]/', '', $name); var_dump('3 '.$name); $name = preg_replace('/[\x{FDD0}-\x{FDEF}]/', '', $name); var_dump('4 '.$name); $name = preg_replace('/[\x{FFF0}-\x{FFFF}]/', '', $name); var_dump('5 '.$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.0150.00416.75
8.3.50.0260.01121.96
8.3.40.0080.00819.04
8.3.30.0090.00619.00
8.3.20.0000.00820.34
8.3.10.0030.00623.57
8.3.00.0080.00022.46
8.2.180.0120.00616.88
8.2.170.0040.01122.96
8.2.160.0100.00720.52
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00422.33
8.2.110.0100.00021.11
8.2.100.0040.00818.03
8.2.90.0030.00519.05
8.2.80.0040.00417.97
8.2.70.0040.00417.88
8.2.60.0050.00318.05
8.2.50.0040.00418.10
8.2.40.0040.00418.22
8.2.30.0030.00618.20
8.2.20.0050.00317.83
8.2.10.0040.00417.98
8.2.00.0060.00318.00
8.1.280.0070.00725.92
8.1.270.0080.00023.96
8.1.260.0000.00826.35
8.1.250.0020.00528.09
8.1.240.0030.00622.66
8.1.230.0000.01117.79
8.1.220.0000.00917.89
8.1.210.0100.00018.77
8.1.200.0090.00017.60
8.1.190.0000.00817.48
8.1.180.0080.00018.10
8.1.170.0030.00618.97
8.1.160.0040.00422.09
8.1.150.0040.00418.79
8.1.140.0030.00517.72
8.1.130.0000.00717.94
8.1.120.0000.00717.55
8.1.110.0040.00417.68
8.1.100.0040.00417.67
8.1.90.0050.00317.50
8.1.80.0030.00317.73
8.1.70.0030.00517.60
8.1.60.0030.00617.82
8.1.50.0030.00617.60
8.1.40.0050.00317.61
8.1.30.0080.00017.79
8.1.20.0000.00917.78
8.1.10.0050.00317.70
8.1.00.0040.00417.64
8.0.300.0040.00418.77
8.0.290.0050.00217.00
8.0.280.0030.00618.46
8.0.270.0070.00017.18
8.0.260.0030.00316.95
8.0.250.0040.00417.15
8.0.240.0040.00417.21
8.0.230.0030.00317.11
8.0.220.0030.00317.08
8.0.210.0000.00717.19
8.0.200.0000.00717.18
8.0.190.0000.00717.16
8.0.180.0050.00217.05
8.0.170.0080.00017.13
8.0.160.0080.00017.21
8.0.150.0000.00817.10
8.0.140.0000.00717.00
8.0.130.0060.00013.57
8.0.120.0060.00317.00
8.0.110.0030.00617.01
8.0.100.0040.00417.10
8.0.90.0030.00517.07
8.0.80.0060.01017.12
8.0.70.0050.00316.96
8.0.60.0000.00917.03
8.0.50.0000.00817.02
8.0.30.0140.00917.44
8.0.20.0070.01317.40
8.0.10.0000.00717.11
8.0.00.0040.01716.96
7.4.330.0030.00315.03
7.4.320.0000.00616.77
7.4.300.0030.00316.70
7.4.290.0030.00316.73
7.4.280.0040.00416.89
7.4.270.0030.00316.87
7.4.260.0070.00016.76
7.4.250.0000.01016.87
7.4.240.0040.00416.79
7.4.230.0040.00416.63
7.4.220.0090.00916.87
7.4.210.0080.00616.86
7.4.200.0040.00416.61
7.4.190.0040.00416.85
7.4.160.0050.01016.70
7.4.150.0210.00017.40
7.4.140.0050.01517.86
7.4.130.0080.01016.72
7.4.120.0090.00916.73
7.4.110.0060.01216.72
7.4.100.0090.00916.96
7.4.90.0120.01716.73
7.4.80.0070.01719.39
7.4.70.0090.00916.56
7.4.60.0070.01016.73
7.4.50.0030.00616.81
7.4.40.0060.00922.77
7.4.30.0060.01016.68
7.4.00.0090.00615.37
7.3.330.0000.00513.40
7.3.320.0000.00613.34
7.3.310.0000.00716.57
7.3.300.0000.00716.42
7.3.290.0060.01216.54
7.3.280.0040.01616.49
7.3.270.0040.01417.40
7.3.260.0090.00916.67
7.3.250.0140.00616.82
7.3.240.0030.02116.81
7.3.230.0110.00716.89
7.3.210.0090.00916.72
7.3.200.0060.01619.39
7.3.190.0060.01216.76
7.3.180.0100.00716.86
7.3.170.0120.00416.63
7.3.160.0100.00716.94
7.3.120.0120.00315.23
7.3.10.0030.00916.66
7.3.00.0000.00916.69
7.2.330.0090.00916.72
7.2.320.0030.01416.84
7.2.310.0130.01016.84
7.2.300.0120.00616.79
7.2.290.0070.01016.82
7.2.130.0000.00916.99
7.2.120.0030.01016.66
7.2.110.0070.00716.71
7.2.100.0060.00616.71
7.2.90.0130.00016.65
7.2.80.0070.01116.75
7.2.70.0000.01316.83
7.2.60.0030.01016.89
7.2.50.0070.00717.02
7.2.40.0030.00916.80
7.2.30.0090.00616.93
7.2.20.0060.00616.64
7.2.10.0060.00917.01
7.2.00.0050.00918.20
7.1.250.0030.01115.90
7.1.100.0030.00718.40
7.1.70.0000.00817.45
7.1.60.0090.01519.29
7.1.50.0070.01117.30
7.1.00.0030.07722.46
7.0.200.0030.00716.91
7.0.140.0030.07021.95
7.0.80.0100.07019.92
7.0.70.0070.08019.92
7.0.60.0200.06719.95
7.0.50.0100.08320.34
7.0.40.0130.03320.10
7.0.30.0070.08319.95
7.0.20.0130.07320.04
7.0.10.0070.04320.03
7.0.00.0130.07720.05
5.6.230.0030.07320.64
5.6.220.0100.07320.66
5.6.210.0130.07320.57
5.6.200.0130.07021.00
5.6.190.0170.07021.19
5.6.180.0100.07320.96
5.6.170.0070.07321.18
5.6.160.0030.05721.10
5.6.150.0030.04721.00
5.6.140.0030.08720.97
5.6.130.0070.08021.18
5.6.120.0130.07321.03
5.6.110.0070.06721.12
5.6.100.0000.05021.09
5.6.90.0130.07721.04
5.6.80.0070.07020.43
5.6.70.0100.08020.41
5.6.60.0070.07320.49
5.6.50.0130.07720.41
5.6.40.0000.08720.48
5.6.30.0100.08020.54
5.6.20.0200.04720.32
5.6.10.0100.07720.30
5.6.00.0000.08320.40
5.5.370.0070.07720.38
5.5.360.0030.08020.37
5.5.350.0030.08320.48
5.5.340.0070.07720.80
5.5.330.0070.08020.91
5.5.320.0100.07320.66
5.5.310.0130.07320.90
5.5.300.0100.03720.86
5.5.290.0070.07720.90
5.5.280.0100.04320.91
5.5.270.0100.08720.77
5.5.260.0000.07320.76
5.5.250.0030.08020.74
5.5.240.0130.07320.27
5.5.230.0000.07720.32
5.5.220.0070.06320.28
5.5.210.0030.08020.17
5.5.200.0070.05020.29
5.5.190.0130.07720.15
5.5.180.0130.07720.25
5.5.160.0000.04720.16
5.5.150.0130.06320.24
5.5.140.0130.06720.25
5.5.130.0070.07720.25
5.5.120.0030.04020.23
5.5.110.0000.07020.07
5.5.100.0070.04020.00
5.5.90.0030.07320.02
5.5.80.0070.06320.08
5.5.70.0100.03320.07
5.5.60.0130.03019.98
5.5.50.0100.05720.01
5.5.40.0070.07320.16
5.5.30.0030.08020.16
5.5.20.0200.05720.04
5.5.10.0130.07020.14
5.5.00.0030.07320.10
5.4.450.0100.07019.49
5.4.440.0030.08019.49
5.4.430.0030.06319.41
5.4.420.0100.07319.38
5.4.410.0170.06719.24
5.4.400.0070.07019.16
5.4.390.0030.06019.14
5.4.380.0100.07319.13
5.4.370.0070.06719.02
5.4.360.0130.07019.15
5.4.350.0030.06319.03
5.4.340.0070.06018.95
5.4.320.0030.07718.89
5.4.310.0070.07319.18
5.4.300.0000.05019.12
5.4.290.0000.06319.02
5.4.280.0000.07319.04
5.4.270.0070.06719.09
5.4.260.0030.04719.12
5.4.250.0070.08319.12
5.4.240.0000.06019.17
5.4.230.0070.07318.83
5.4.220.0030.07719.02
5.4.210.0030.07319.02
5.4.200.0030.06719.16
5.4.190.0030.04719.08
5.4.180.0000.06319.11
5.4.170.0200.06019.11
5.4.160.0030.04319.16
5.4.150.0070.07719.01
5.4.140.0100.06316.38
5.4.130.0100.05716.49
5.4.120.0030.07016.51
5.4.110.0000.04016.55
5.4.100.0070.05016.38
5.4.90.0030.07316.45
5.4.80.0100.06716.54
5.4.70.0170.05716.31
5.4.60.0030.07716.33
5.4.50.0100.03316.34
5.4.40.0070.07016.49
5.4.30.0000.07716.48
5.4.20.0000.04716.32
5.4.10.0100.07016.32
5.4.00.0070.06015.88
5.3.290.0000.08314.65
5.3.280.0100.06714.63
5.3.270.0000.04314.62
5.3.260.0100.04314.59
5.3.250.0070.07014.75
5.3.240.0030.08014.63
5.3.230.0000.06714.64
5.3.220.0030.07314.68
5.3.210.0030.08314.58
5.3.200.0130.03014.70
5.3.190.0100.07714.51
5.3.180.0070.06714.68
5.3.170.0070.07714.51
5.3.160.0070.07314.69
5.3.150.0130.06314.57
5.3.140.0000.07714.50
5.3.130.0000.03714.56
5.3.120.0100.07014.56
5.3.110.0030.07314.58
5.3.100.0030.04314.18
5.3.90.0070.05314.13
5.3.80.0070.03014.01
5.3.70.0000.05013.95
5.3.60.0030.03714.11
5.3.50.0030.04714.00
5.3.40.0000.04013.98
5.3.30.0070.03313.99
5.3.20.0030.03013.77
5.3.10.0000.03713.61
5.3.00.0000.03313.66
5.2.170.0070.02313.26
5.2.160.0000.03013.26
5.2.150.0070.03013.26
5.2.140.0030.02713.26
5.2.130.0000.02713.26
5.2.120.0000.03013.26
5.2.110.0030.02713.26
5.2.100.0030.02713.26
5.2.90.0000.03313.26
5.2.80.0030.03713.26
5.2.70.0000.03313.26
5.2.60.0000.03313.26
5.2.50.0030.02713.26
5.2.40.0030.04313.26
5.2.30.0000.02713.26
5.2.20.0100.03013.26
5.2.10.0070.03713.26
5.2.00.0070.04713.26
5.1.60.0000.02313.26
5.1.50.0030.02313.26
5.1.40.0030.02013.26
5.1.30.0000.02713.26
5.1.20.0000.04013.26
5.1.10.0070.02713.26
5.1.00.0030.02313.26
5.0.50.0030.01713.26
5.0.40.0030.01713.26
5.0.30.0000.03013.26
5.0.20.0000.01713.26
5.0.10.0000.02013.26
5.0.00.0000.03013.26
4.4.90.0000.01713.26
4.4.80.0030.01313.26
4.4.70.0030.02713.26
4.4.60.0000.01713.26
4.4.50.0030.01313.26
4.4.40.0000.02313.26
4.4.30.0000.01713.26
4.4.20.0000.01313.26
4.4.10.0030.01313.26
4.4.00.0000.02713.26
4.3.110.0030.01313.26
4.3.100.0000.01313.26
4.3.90.0000.01313.26
4.3.80.0000.02313.26
4.3.70.0000.01713.26
4.3.60.0000.02013.26
4.3.50.0000.01713.26
4.3.40.0030.02013.26
4.3.30.0000.01713.26
4.3.20.0000.01713.26
4.3.10.0000.01713.26
4.3.00.0000.01313.26

preferences:
42.39 ms | 401 KiB | 5 Q