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}\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.0060.00918.65
8.3.50.0130.00621.27
8.3.40.0110.00418.84
8.3.30.0070.00718.79
8.3.20.0000.00818.79
8.3.10.0060.00319.07
8.3.00.0000.00823.52
8.2.180.0220.00016.75
8.2.170.0120.00322.96
8.2.160.0070.00720.39
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0040.00421.16
8.2.110.0090.00020.38
8.2.100.0110.00017.91
8.2.90.0040.00419.20
8.2.80.0000.00718.04
8.2.70.0030.00617.75
8.2.60.0000.00817.93
8.2.50.0060.00318.07
8.2.40.0110.00018.20
8.2.30.0040.00419.87
8.2.20.0040.00417.91
8.2.10.0030.00617.91
8.2.00.0030.00617.86
8.1.280.0120.00325.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0140.00423.86
8.1.230.0090.00324.03
8.1.220.0040.00418.86
8.1.210.0060.00318.77
8.1.200.0060.00317.60
8.1.190.0000.00917.65
8.1.180.0000.00818.10
8.1.170.0040.00418.78
8.1.160.0040.00419.05
8.1.150.0000.00818.76
8.1.140.0000.00817.59
8.1.130.0000.00717.79
8.1.120.0000.00817.61
8.1.110.0040.00417.54
8.1.100.0040.00417.70
8.1.90.0040.00417.59
8.1.80.0000.00817.70
8.1.70.0000.00817.53
8.1.60.0030.00517.62
8.1.50.0030.00517.71
8.1.40.0040.00417.55
8.1.30.0040.00417.73
8.1.20.0050.00317.82
8.1.10.0000.00817.69
8.1.00.0080.00017.64
8.0.300.0040.00420.20
8.0.290.0040.00417.18
8.0.280.0040.00418.51
8.0.270.0090.00017.32
8.0.260.0000.00717.14
8.0.250.0050.00217.16
8.0.240.0000.00917.25
8.0.230.0000.00817.18
8.0.220.0080.00017.05
8.0.210.0040.00417.08
8.0.200.0000.00817.18
8.0.190.0050.00317.07
8.0.180.0080.00017.18
8.0.170.0040.00417.16
8.0.160.0030.00317.18
8.0.150.0040.00417.18
8.0.140.0070.00017.15
8.0.130.0050.00013.56
8.0.120.0000.00717.13
8.0.110.0040.00416.93
8.0.100.0040.00416.95
8.0.90.0050.00317.10
8.0.80.0090.01317.16
8.0.70.0000.00817.20
8.0.60.0030.00517.01
8.0.50.0040.00416.98
8.0.30.0120.01017.29
8.0.20.0100.00917.40
8.0.10.0030.00617.02
8.0.00.0070.01116.80
7.4.330.0060.00015.05
7.4.320.0000.00716.61
7.4.300.0070.00016.85
7.4.290.0070.00016.75
7.4.280.0000.00816.68
7.4.270.0040.00416.73
7.4.260.0000.00613.50
7.4.250.0070.00016.68
7.4.240.0000.00816.77
7.4.230.0000.00716.56
7.4.220.0150.00316.79
7.4.210.0090.00716.86
7.4.200.0080.00016.62
7.4.190.0040.00416.70
7.4.160.0100.00616.61
7.4.150.0110.00717.40
7.4.140.0070.01317.86
7.4.130.0120.00416.76
7.4.120.0050.01316.79
7.4.110.0090.00916.61
7.4.100.0180.00616.80
7.4.90.0120.00616.73
7.4.80.0090.01019.37
7.4.70.0150.00316.65
7.4.60.0140.00316.66
7.4.50.0030.00616.71
7.4.40.0110.00722.52
7.4.30.0100.00716.60
7.4.00.0070.00915.33
7.3.330.0050.00013.46
7.3.320.0050.00013.30
7.3.310.0040.00416.44
7.3.300.0030.00316.59
7.3.290.0060.00916.45
7.3.280.0060.00816.56
7.3.270.0070.01117.40
7.3.260.0130.00518.24
7.3.250.0090.01016.75
7.3.240.0140.00916.69
7.3.230.0110.01016.60
7.3.210.0120.00616.79
7.3.200.0080.00919.39
7.3.190.0070.01016.55
7.3.180.0070.01016.48
7.3.170.0110.00616.71
7.3.160.0110.00616.48
7.3.120.0080.00715.20
7.3.110.0100.00715.24
7.3.100.0100.00615.04
7.3.90.0080.00615.25
7.3.80.0030.01315.33
7.3.70.0090.00315.06
7.3.60.0040.00815.07
7.3.50.0000.00915.22
7.3.40.0030.01015.17
7.3.30.0030.00614.85
7.3.20.0030.00917.00
7.3.10.0000.00916.81
7.3.00.0060.00616.75
7.2.330.0160.00616.75
7.2.320.0110.00716.82
7.2.310.0100.01016.74
7.2.300.0050.01116.89
7.2.290.0110.01216.80
7.2.250.0090.00915.33
7.2.240.0030.01715.04
7.2.230.0080.00515.35
7.2.220.0110.00315.23
7.2.210.0070.01015.23
7.2.200.0060.00615.28
7.2.190.0120.00314.91
7.2.180.0030.00615.29
7.2.170.0130.00314.92
7.2.60.0040.01117.13
7.2.50.0120.01417.13
7.1.330.0070.00716.19
7.1.320.0100.00316.13
7.1.310.0030.00715.69
7.1.300.0040.01116.05
7.1.290.0000.01315.97
7.1.280.0090.00616.04
7.1.270.0100.00015.80
7.1.260.0030.00515.88
7.1.200.0030.00815.87
7.1.70.0040.00817.46
7.1.60.0120.01219.40
7.1.50.0070.00716.98
7.1.00.0030.04022.55
7.0.200.0000.00916.98
7.0.140.0000.07322.04
7.0.70.0000.03321.66
7.0.60.0030.03721.72
7.0.50.0000.08722.15
7.0.40.0000.07320.09
7.0.30.0070.04319.95
7.0.20.0000.08720.14
7.0.10.0000.08720.06
7.0.00.0070.08320.15
5.6.280.0070.07020.82
5.6.220.0000.03320.43
5.6.210.0000.03320.62
5.6.200.0030.03721.06
5.6.190.0030.03321.11
5.6.180.0070.05721.10
5.6.170.0130.08021.02
5.6.160.0100.06721.03
5.6.150.0100.07321.06
5.6.140.0100.07721.11
5.6.130.0100.07720.96
5.6.120.0030.08021.05
5.6.110.0030.07320.99
5.6.100.0100.07720.95
5.6.90.0130.08720.93
5.6.80.0000.07720.39
5.6.70.0030.07320.41
5.6.60.0000.07020.39
5.6.50.0000.06720.43
5.6.40.0170.06720.38
5.6.30.0100.06020.39
5.6.20.0030.04320.41
5.6.10.0030.05020.41
5.6.00.0070.07320.39
5.5.360.0030.03320.37
5.5.350.0000.04720.33
5.5.340.0000.04320.81
5.5.330.0030.03020.83
5.5.320.0000.08020.80
5.5.310.0100.08020.91
5.5.300.0030.08320.74
5.5.290.0070.06320.77
5.5.280.0000.08020.73
5.5.270.0030.08320.76
5.5.260.0000.08720.73
5.5.250.0000.08320.57
5.5.240.0070.06720.32
5.5.230.0100.07320.15
5.5.220.0000.08020.29
5.5.210.0070.07020.18
5.5.200.0100.07020.29
5.5.190.0100.07320.21
5.5.180.0070.06720.18
5.5.160.0030.07720.18
5.5.150.0070.07320.21
5.5.140.0030.08020.22
5.5.130.0070.08020.23
5.5.120.0100.07320.18
5.5.110.0000.08320.10
5.5.100.0100.07020.08
5.5.90.0000.07320.06
5.5.80.0100.07020.15
5.5.70.0000.08020.04
5.5.60.0070.08019.96
5.5.50.0100.07319.95
5.5.40.0100.06720.05
5.5.30.0130.07020.07
5.5.20.0070.06720.09
5.5.10.0070.06319.96
5.5.00.0000.08319.97
5.4.450.0070.04019.22
5.4.440.0130.06019.33
5.4.430.0030.08719.40
5.4.420.0070.07319.23
5.4.410.0070.07319.39
5.4.400.0000.07719.16
5.4.390.0030.05019.11
5.4.380.0000.08018.84
5.4.370.0000.08019.16
5.4.360.0030.08018.87
5.4.350.0000.07719.15
5.4.340.0000.04318.91
5.4.320.0000.07719.19
5.4.310.0030.07719.17
5.4.300.0070.07019.13
5.4.290.0070.07718.86
5.4.280.0070.07319.11
5.4.270.0030.05319.04
5.4.260.0070.07019.14
5.4.250.0030.08018.86
5.4.240.0000.07719.20
5.4.230.0000.08319.01
5.4.220.0000.08319.19
5.4.210.0030.07719.16
5.4.200.0100.07018.83
5.4.190.0030.06318.93
5.4.180.0070.06719.01
5.4.170.0070.05019.14
5.4.160.0030.05019.01
5.4.150.0070.07318.82
5.4.140.0030.05316.33
5.4.130.0100.07016.44
5.4.120.0030.06716.44
5.4.110.0070.07016.54
5.4.100.0030.07716.32
5.4.90.0070.05716.48
5.4.80.0100.05716.46
5.4.70.0100.06316.40
5.4.60.0030.07016.39
5.4.50.0070.07316.35
5.4.40.0030.07016.49
5.4.30.0070.06716.44
5.4.20.0100.07016.34
5.4.10.0030.07316.30
5.4.00.0100.06715.80
5.3.290.0030.07314.79
5.3.280.0000.08014.58
5.3.270.0030.08014.57
5.3.260.0000.04314.68
5.3.250.0100.07314.60
5.3.240.0000.07714.58
5.3.230.0000.05314.65
5.3.220.0100.06714.72
5.3.210.0070.08014.60
5.3.200.0000.08714.51
5.3.190.0030.07014.65
5.3.180.0030.07714.55
5.3.170.0070.06014.69
5.3.160.0070.07314.61
5.3.150.0030.07714.57
5.3.140.0030.06314.50
5.3.130.0030.07714.59
5.3.120.0000.07714.63
5.3.110.0000.06014.54
5.3.100.0070.07014.01
5.3.90.0070.07014.11
5.3.80.0030.05313.93
5.3.70.0030.04314.03
5.3.60.0070.07013.91
5.3.50.0000.07713.98
5.3.40.0000.06314.07
5.3.30.0030.07313.86
5.3.20.0070.06713.77
5.3.10.0000.07713.59
5.3.00.0030.05013.70
5.2.170.0100.05712.54
5.2.160.0070.05012.54
5.2.150.0000.06312.54
5.2.140.0030.05012.54
5.2.130.0070.05312.54
5.2.120.0000.06312.54
5.2.110.0000.05312.54
5.2.100.0030.05712.54
5.2.90.0030.05312.54
5.2.80.0000.05312.54
5.2.70.0000.07012.54
5.2.60.0030.06012.54
5.2.50.0070.05712.54
5.2.40.0070.04312.54
5.2.30.0000.06312.54
5.2.20.0000.06012.54
5.2.10.0070.04712.54
5.2.00.0030.06012.54
5.1.60.0070.05012.54
5.1.50.0030.05012.54
5.1.40.0030.04312.54
5.1.30.0000.05712.54
5.1.20.0030.05312.54
5.1.10.0030.04312.54
5.1.00.0000.05712.54
5.0.50.0030.04012.54
5.0.40.0000.04712.54
5.0.30.0030.06312.54
5.0.20.0030.04012.54
5.0.10.0070.03712.54
5.0.00.0030.06312.54
4.4.90.0000.03012.54
4.4.80.0070.03012.54
4.4.70.0000.03312.54
4.4.60.0000.03312.54
4.4.50.0030.03012.54
4.4.40.0000.05712.54
4.4.30.0030.03012.54
4.4.20.0070.03312.54
4.4.10.0030.02012.54
4.4.00.0030.05312.54
4.3.110.0030.03312.54
4.3.100.0070.02012.54
4.3.90.0030.03312.54
4.3.80.0030.05312.54
4.3.70.0030.03012.54
4.3.60.0000.03312.54
4.3.50.0030.02712.54
4.3.40.0000.05012.54
4.3.30.0030.02312.54
4.3.20.0030.03712.54
4.3.10.0000.03712.54
4.3.00.0030.03712.54

preferences:
41.79 ms | 401 KiB | 5 Q