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}]/u', '', $name); $name = preg_replace('/[\x{0080}-\x{009F}]/u', '', $name); $name = preg_replace('/[\x{E000}-\x{F8FF}]/u', '', $name); $name = preg_replace('/[\x{FDD0}-\x{FDEF}]/u', '', $name); $name = preg_replace('/[\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.0110.00418.43
8.3.50.0100.01022.20
8.3.40.0110.00418.83
8.3.30.0090.00619.01
8.3.20.0000.00820.16
8.3.10.0050.00322.14
8.3.00.0000.00822.33
8.2.180.0080.00818.54
8.2.170.0160.00622.96
8.2.160.0150.00321.06
8.2.150.0130.00324.18
8.2.140.0050.00324.66
8.2.130.0000.00826.16
8.2.120.0060.00319.61
8.2.110.0030.00622.23
8.2.100.0030.01018.16
8.2.90.0040.00418.00
8.2.80.0040.00418.05
8.2.70.0050.00318.16
8.2.60.0040.00418.16
8.2.50.0050.00318.10
8.2.40.0000.00820.36
8.2.30.0080.00018.04
8.2.20.0030.00518.00
8.2.10.0050.00318.11
8.2.00.0040.00418.03
8.1.280.0100.01025.92
8.1.270.0040.00423.91
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00920.81
8.1.230.0030.00719.13
8.1.220.0000.00917.90
8.1.210.0050.00318.77
8.1.200.0030.00617.60
8.1.190.0030.00517.48
8.1.180.0000.00918.10
8.1.170.0040.00418.77
8.1.160.0000.00822.15
8.1.150.0040.00418.83
8.1.140.0040.00417.72
8.1.130.0030.00317.95
8.1.120.0040.00417.64
8.1.110.0000.00717.67
8.1.100.0050.00317.60
8.1.90.0040.00417.63
8.1.80.0000.00817.71
8.1.70.0030.00317.63
8.1.60.0030.00617.80
8.1.50.0040.00417.77
8.1.40.0060.00317.62
8.1.30.0040.00417.88
8.1.20.0060.00317.71
8.1.10.0030.00617.78
8.1.00.0050.00317.56
8.0.300.0000.00720.05
8.0.290.0040.00417.00
8.0.280.0040.00218.41
8.0.270.0000.00717.22
8.0.260.0070.00017.16
8.0.250.0000.00717.28
8.0.240.0050.00317.22
8.0.230.0070.00017.12
8.0.220.0000.00717.18
8.0.210.0000.00717.10
8.0.200.0000.00717.23
8.0.190.0070.00017.25
8.0.180.0000.00817.10
8.0.170.0030.00517.12
8.0.160.0040.00417.14
8.0.150.0000.01017.10
8.0.140.0000.00817.05
8.0.130.0000.00613.64
8.0.120.0000.00817.02
8.0.110.0000.00717.03
8.0.100.0000.00817.05
8.0.90.0040.00417.15
8.0.80.0080.00817.11
8.0.70.0040.00417.16
8.0.60.0040.00417.04
8.0.50.0000.00717.19
8.0.30.0130.00817.18
8.0.20.0160.00317.40
8.0.10.0040.00417.20
8.0.00.0100.00917.03
7.4.330.0030.00315.04
7.4.320.0070.00016.91
7.4.300.0030.00316.90
7.4.290.0070.00016.75
7.4.280.0030.00316.79
7.4.270.0000.00716.80
7.4.260.0030.00816.86
7.4.250.0000.00716.73
7.4.240.0010.00616.80
7.4.230.0070.00016.79
7.4.220.0110.00717.02
7.4.210.0070.00816.93
7.4.200.0080.00016.95
7.4.190.0040.00416.66
7.4.160.0080.00816.84
7.4.150.0120.00617.40
7.4.140.0100.00917.86
7.4.130.0120.00716.71
7.4.120.0090.00916.76
7.4.110.0070.01016.61
7.4.100.0060.01216.80
7.4.90.0120.00616.80
7.4.80.0180.00016.86
7.4.70.0030.01416.71
7.4.60.0130.00316.72
7.4.50.0040.00416.88
7.4.40.0000.01022.77
7.4.30.0060.01317.00
7.4.10.0130.00716.62
7.4.00.0060.00915.94
7.3.330.0000.00513.39
7.3.320.0000.00713.57
7.3.310.0050.00316.46
7.3.300.0070.00016.62
7.3.290.0100.01316.55
7.3.280.0080.00816.58
7.3.270.0040.01517.40
7.3.260.0180.00616.82
7.3.250.0090.00916.74
7.3.240.0070.01016.63
7.3.230.0030.01316.85
7.3.210.0080.00916.96
7.3.200.0060.01519.39
7.3.190.0090.00916.89
7.3.180.0080.00816.53
7.3.170.0030.01416.62
7.3.160.0190.00316.59
7.3.130.0040.01416.60
7.3.120.0050.01015.84
7.3.110.0090.00616.61
7.3.100.0090.00416.47
7.3.90.0060.00616.65
7.3.80.0140.00016.52
7.3.70.0090.00316.41
7.3.60.0040.00716.55
7.3.50.0100.00616.46
7.3.40.0070.00716.46
7.3.30.0060.00616.54
7.3.20.0000.01318.16
7.3.10.0050.00518.23
7.3.00.0030.00618.40
7.2.330.0140.00316.86
7.2.320.0120.00816.87
7.2.310.0040.01316.88
7.2.300.0030.01316.87
7.2.290.0130.00316.91
7.2.260.0120.00816.86
7.2.250.0070.01316.59
7.2.240.0030.01216.81
7.2.230.0070.00716.70
7.2.220.0060.00916.75
7.2.210.0030.01316.86
7.2.200.0000.01016.63
7.2.190.0000.01216.71
7.2.180.0060.00616.73
7.2.170.0040.01116.61
7.2.160.0030.00916.66
7.2.150.0030.00618.60
7.2.140.0080.00818.59
7.2.130.0060.00918.55
7.2.120.0070.00718.44
7.2.110.0080.00418.65
7.2.100.0060.01018.50
7.2.90.0090.00618.44
7.2.80.0110.00318.51
7.2.70.0120.00318.54
7.2.60.0090.00918.47
7.2.50.0040.00818.57
7.2.40.0030.01018.55
7.2.30.0090.00818.67
7.2.20.0100.00318.63
7.2.10.0050.00518.64
7.2.00.0030.01219.09
7.1.330.0000.01517.43
7.1.320.0030.01017.54
7.1.310.0100.00317.57
7.1.300.0060.00317.64
7.1.290.0050.00517.61
7.1.280.0040.01417.50
7.1.270.0060.00617.57
7.1.260.0000.01117.55
7.1.250.0040.01017.55
7.1.240.0030.00817.57
7.1.230.0000.01217.62
7.1.220.0060.00917.48
7.1.210.0090.00317.54
7.1.200.0070.00516.72
7.1.190.0030.00817.38
7.1.180.0080.00417.61
7.1.170.0090.00917.65
7.1.160.0080.00417.48
7.1.150.0060.00617.46
7.1.140.0000.01017.38
7.1.130.0060.00517.34
7.1.120.0060.00917.41
7.1.110.0000.01017.52
7.1.100.0050.00717.93
7.1.90.0030.01017.46
7.1.80.0030.00917.45
7.1.70.0000.01217.47
7.1.60.0080.00918.67
7.1.50.0060.00617.36
7.1.40.0070.00717.47
7.1.30.0140.00417.35
7.1.20.0080.00317.65
7.1.10.0080.00517.60
7.1.00.0070.03819.92
7.0.330.0040.00417.18
7.0.320.0000.01417.19
7.0.310.0070.00717.04
7.0.300.0030.00717.27
7.0.290.0000.01317.08
7.0.280.0070.00717.23
7.0.270.0040.00417.08
7.0.260.0060.01016.96
7.0.250.0040.00717.28
7.0.240.0070.00717.41
7.0.230.0070.00317.03
7.0.220.0030.01517.15
7.0.210.0090.00617.17
7.0.200.0070.00417.13
7.0.190.0000.01217.41
7.0.180.0060.00817.16
7.0.170.0030.01217.11
7.0.160.0140.00317.13
7.0.150.0060.00617.33
7.0.140.0040.04119.62
7.0.130.0080.00417.21
7.0.120.0070.00716.89
7.0.110.0070.00717.11
7.0.100.0000.00917.23
7.0.90.0110.00417.35
7.0.80.0060.00317.44
7.0.70.0070.00717.02
7.0.60.0090.04318.75
7.0.50.0070.04117.50
7.0.40.0050.02817.73
7.0.30.0130.03817.64
7.0.20.0150.03017.73
7.0.10.0070.02517.49
7.0.00.0050.02417.79
5.6.400.0090.00915.63
5.6.390.0060.00616.03
5.6.380.0030.01016.00
5.6.370.0060.00915.76
5.6.360.0030.01216.19
5.6.350.0070.01115.85
5.6.340.0040.00816.04
5.6.330.0070.00716.13
5.6.320.0040.00715.92
5.6.310.0080.00815.67
5.6.300.0030.01316.02
5.6.290.0070.00316.30
5.6.280.0040.04018.40
5.6.270.0120.00315.72
5.6.260.0040.01115.96
5.6.250.0000.01615.75
5.6.240.0030.00616.02
5.6.230.0060.00915.95
5.6.220.0070.00715.96
5.6.210.0080.02818.46
5.6.200.0040.04717.04
5.6.190.0070.04518.38
5.6.180.0040.02218.25
5.6.170.0180.03618.25
5.6.160.0090.04618.25
5.6.150.0070.03217.16
5.6.140.0070.04217.05
5.6.130.0030.02917.07
5.6.120.0060.02518.41
5.6.110.0140.03918.34
5.6.100.0080.03918.43
5.6.90.0090.04318.49
5.6.80.0100.03318.05
5.6.70.0060.00915.99
5.6.60.0090.00016.02
5.6.50.0030.01015.94
5.6.40.0030.01615.86
5.6.30.0050.00515.81
5.6.20.0060.00915.93
5.6.10.0120.00015.98
5.6.00.0100.00315.76
5.5.380.0070.00715.94
5.5.370.0000.01115.88
5.5.360.0070.01016.03
5.5.350.0040.03918.13
5.5.340.0140.03517.04
5.5.330.0040.02418.26
5.5.320.0000.03418.16
5.5.310.0130.03318.04
5.5.300.0110.03616.95
5.5.290.0030.03016.98
5.5.280.0100.03418.37
5.5.270.0060.04618.35
5.5.260.0080.03518.37
5.5.250.0110.04118.07
5.5.240.0070.03517.98
5.5.230.0070.00715.84
5.5.220.0100.00315.84
5.5.210.0060.00915.77
5.5.200.0090.00615.83
5.5.190.0030.01015.61
5.5.180.0060.00615.70
5.5.170.0040.00815.93
5.5.160.0060.01015.68
5.5.150.0060.01015.89
5.5.140.0000.01515.84
5.5.130.0030.00615.92
5.5.120.0060.00915.81
5.5.110.0090.00615.70
5.5.100.0060.00615.73
5.5.90.0080.00815.85
5.5.80.0060.00915.72
5.5.70.0060.00915.66
5.5.60.0060.01315.73
5.5.50.0060.01115.80
5.5.40.0110.00316.00
5.5.30.0040.01115.85
5.5.20.0070.00716.04
5.5.10.0130.00315.82
5.5.00.0090.00915.73
5.4.450.1050.02216.15
5.4.440.0900.02916.13
5.4.430.0920.02216.09
5.4.420.0930.02616.20
5.4.410.1070.02316.10
5.4.400.0920.02215.98
5.4.390.0920.02215.95
5.4.380.0940.01915.79
5.4.370.0930.01815.78
5.4.360.0930.02315.87
5.4.350.0900.02215.96
5.4.340.0980.02315.77
5.4.330.0030.01212.98
5.4.320.0950.02215.85
5.4.310.0940.01915.98
5.4.300.0980.02215.96
5.4.290.1020.02715.95
5.4.280.0950.02715.78
5.4.270.1030.01715.88
5.4.260.0980.02116.04
5.4.250.1130.02116.00
5.4.240.1080.02015.98
5.4.230.1080.02915.73
5.4.220.0910.02215.91
5.4.210.0870.02315.89
5.4.200.1030.01815.94
5.4.190.0920.03115.96
5.4.180.0980.02415.95
5.4.170.1120.02715.66
5.4.160.0960.02115.82
5.4.150.0860.02115.74
5.4.140.0900.02214.58
5.4.130.0770.02214.57
5.4.120.1050.02314.68
5.4.110.0050.02814.49
5.4.100.0060.02314.51
5.4.90.0020.02214.57
5.4.80.0550.02514.43
5.4.70.1080.02114.63
5.4.60.0930.01714.51
5.4.50.0000.03114.51
5.4.40.0110.01814.65
5.4.30.0000.03514.43
5.4.20.0780.02214.49
5.4.10.0870.02014.52
5.4.00.0060.02014.23
5.3.290.0010.03113.92
5.3.280.0550.02313.96
5.3.270.0900.02113.82
5.3.260.0920.02013.99
5.3.250.0820.02613.86
5.3.240.0900.02213.85
5.3.230.0950.01813.82
5.3.220.0850.02013.77
5.3.210.0830.02413.73
5.3.200.0930.02213.90
5.3.190.0930.01813.84
5.3.180.0830.02313.87
5.3.170.0770.02413.84
5.3.160.0880.02313.99
5.3.150.0910.02113.88
5.3.140.0860.02013.84
5.3.130.0900.02113.79
5.3.120.0880.02114.05
5.3.110.0680.02513.77
5.3.100.0900.02013.55
5.3.90.0980.02513.56
5.3.80.0980.02613.54
5.3.70.1020.02313.59
5.3.60.0900.02113.51
5.3.50.0950.03113.45
5.3.40.0920.01813.49
5.3.30.0920.02513.47
5.3.20.1050.02213.47
5.3.10.0870.02313.24
5.3.00.0930.02013.26
5.2.170.1430.03011.32
5.2.160.1430.02711.13
5.2.150.1730.03311.18
5.2.140.1630.03011.28
5.2.130.1530.04011.04
5.2.120.1600.03711.35
5.2.110.1430.03011.02
5.2.100.1470.02311.08
5.2.90.1370.03311.13
5.2.80.1400.03311.03
5.2.70.1530.02711.09
5.2.60.1500.03011.00
5.2.50.1700.03311.04
5.2.40.1130.03011.13
5.2.30.1170.02710.89
5.2.20.1170.03010.90
5.2.10.1170.03010.80
5.2.00.1230.03010.75
5.1.60.1270.0209.99
5.1.50.1230.02310.02
5.1.40.1330.0239.90
5.1.30.1400.02010.27
5.1.20.1300.02710.49
5.1.10.1200.02310.24
5.1.00.1170.02710.18
5.0.50.0770.0238.47
5.0.40.0800.0238.56
5.0.30.0830.0438.15
5.0.20.0670.0238.27
5.0.10.0830.0238.18
5.0.00.0570.0338.08
4.4.90.0670.0107.63
4.4.80.0770.0277.63
4.4.70.0770.0277.63
4.4.60.0770.0237.63
4.4.50.0900.0177.63
4.4.40.0630.0237.63
4.4.30.0730.0237.63
4.4.20.0730.0237.63
4.4.10.0700.0207.63
4.4.00.0630.0237.63
4.3.110.0570.0177.63
4.3.100.0730.0277.63
4.3.90.0870.0207.63
4.3.80.0770.0307.63
4.3.70.0870.0207.63
4.3.60.0930.0177.63
4.3.50.0970.0207.63
4.3.40.0870.0277.63
4.3.30.0530.0277.63
4.3.20.0470.0137.63
4.3.10.0530.0237.63
4.3.00.0570.0137.63

preferences:
45.3 ms | 401 KiB | 5 Q