3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sanitizeFilename($name) { $res = preg_replace('\w:\s', ' - ', $name); $res = preg_replace('\s:\s', '', $res); $res = strtr($res, [ '<' => '-', '>' => '-', ':' => '-', '"' => '', '/' => '-', '\\' => '-', '|' => '-', '?' => '', '*' => '-' ]); $res = preg_replace('\s{2,}', ' ', $res); return $res; } var_dump(sanitizeFilename('The Hobbit: an unexpected')); var_dump(sanitizeFilename('The Hobbit:forever')); var_dump(sanitizeFilename('The Hobbit 50:50')); var_dump(sanitizeFilename('The Hobbit 50 : 50'));

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.00716.63
8.3.50.0290.00922.82
8.3.40.0160.00318.67
8.3.30.0140.00319.01
8.3.20.0000.00820.20
8.3.10.0050.00320.58
8.3.00.0000.00719.12
8.2.180.0070.01418.19
8.2.170.0090.00622.96
8.2.160.0100.00320.57
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.36
8.2.110.0050.00522.08
8.2.100.0130.00017.91
8.2.90.0040.00419.21
8.2.80.0040.00419.21
8.2.70.0030.00617.38
8.2.60.0030.00517.80
8.2.50.0030.00618.07
8.2.40.0040.00417.97
8.2.30.0040.00419.30
8.2.20.0080.00017.55
8.2.10.0000.00818.04
8.2.00.0020.00517.74
8.1.280.0070.00725.92
8.1.270.0030.00622.02
8.1.260.0080.00026.35
8.1.250.0030.00528.09
8.1.240.0060.00322.46
8.1.230.0040.00720.85
8.1.220.0040.00418.77
8.1.210.0040.00418.77
8.1.200.0040.00417.25
8.1.190.0000.00717.51
8.1.180.0040.00418.10
8.1.170.0000.00818.51
8.1.160.0000.00718.74
8.1.150.0050.00218.80
8.1.140.0000.00717.35
8.1.130.0070.00017.70
8.1.120.0030.00617.26
8.1.110.0080.00017.29
8.1.100.0040.00417.32
8.1.90.0040.00417.37
8.1.80.0020.00517.34
8.1.70.0030.00317.28
8.1.60.0000.00817.51
8.1.50.0000.00817.50
8.1.40.0040.00417.56
8.1.30.0050.00317.48
8.1.20.0030.00517.53
8.1.10.0030.00517.41
8.1.00.0060.00317.41
8.0.300.0000.00720.02
8.0.290.0040.00417.15
8.0.280.0000.00718.41
8.0.270.0000.00717.06
8.0.260.0000.00617.20
8.0.250.0030.00316.85
8.0.240.0040.00416.88
8.0.230.0090.00016.83
8.0.220.0000.00716.76
8.0.210.0000.00716.78
8.0.200.0070.00016.98
8.0.190.0000.00816.98
8.0.180.0030.00316.80
8.0.170.0040.00416.89
8.0.160.0040.00416.94
8.0.150.0050.00316.88
8.0.140.0040.00416.87
8.0.130.0000.00513.38
8.0.120.0000.00916.78
8.0.110.0000.00716.86
8.0.100.0070.00016.91
8.0.90.0020.00516.91
8.0.80.0060.01216.89
8.0.70.0080.00016.90
8.0.60.0050.00316.75
8.0.50.0040.00416.70
8.0.30.0080.01117.06
8.0.20.0140.00817.40
8.0.10.0000.00716.96
8.0.00.0140.00316.92
7.4.330.0000.00515.02
7.4.320.0070.00016.53
7.4.300.0000.00616.61
7.4.290.0000.00716.58
7.4.280.0080.00016.48
7.4.270.0030.00316.61
7.4.260.0000.00816.46
7.4.250.0000.00716.51
7.4.240.0060.00216.56
7.4.230.0000.00716.67
7.4.220.0060.01216.55
7.4.210.0070.00816.59
7.4.200.0050.00316.68
7.4.160.0110.00516.52
7.4.150.0090.00917.40
7.4.140.0100.00817.86
7.4.130.0110.00716.52
7.4.120.0030.01616.39
7.4.110.0100.01016.58
7.4.100.0120.00616.48
7.4.90.0030.01316.32
7.4.80.0080.00916.52
7.4.70.0180.00316.23
7.4.60.0180.00016.55
7.4.50.0030.00616.33
7.4.40.0130.00916.54
7.4.30.0080.01516.47
7.4.00.0040.01414.79
7.3.330.0030.00313.14
7.3.320.0020.00213.23
7.3.310.0070.00016.33
7.3.300.0030.00316.18
7.3.290.0060.01016.27
7.3.280.0100.00916.29
7.3.270.0100.00917.40
7.3.260.0160.00916.54
7.3.250.0090.01116.37
7.3.240.0060.00916.34
7.3.230.0060.01216.50
7.3.210.0180.00016.18
7.3.200.0120.01219.39
7.3.190.0080.00816.38
7.3.180.0080.00816.51
7.3.170.0120.00416.28
7.3.160.0060.00916.65
7.3.10.0040.01116.70
7.3.00.0080.00316.70
7.2.330.0040.01516.55
7.2.320.0100.00716.55
7.2.310.0170.00316.65
7.2.300.0120.00916.54
7.2.290.0170.00616.64
7.2.130.0070.00716.47
7.2.120.0050.00516.75
7.2.110.0100.00716.64
7.2.100.0120.00616.58
7.2.90.0110.00316.82
7.2.80.0060.01016.65
7.2.70.0000.01516.52
7.2.60.0000.01616.41
7.2.50.0030.00616.93
7.2.40.0090.00916.95
7.2.30.0110.00416.76
7.2.20.0070.00716.84
7.2.10.0060.00916.67
7.2.00.0120.01118.03
7.1.250.0070.00715.57
7.1.100.0090.00617.93
7.1.70.0000.01117.00
7.1.60.0080.00417.32
7.1.50.0070.01416.63
7.1.00.0030.07722.40
7.0.200.0070.01116.66
7.0.140.0070.07022.04
7.0.60.0100.08020.01
7.0.50.0070.08317.84
7.0.40.0000.08720.30
7.0.30.0300.07720.25
7.0.20.0270.07020.30
7.0.10.0030.06320.16
7.0.00.0030.05320.18
5.6.280.0070.09321.07
5.6.210.0030.08720.69
5.6.200.0070.05318.18
5.6.190.0200.07320.57
5.6.180.0030.04320.64
5.6.170.0330.03320.58
5.6.160.0000.07320.41
5.6.150.0170.06318.17
5.6.140.0070.08318.28
5.6.130.0000.04718.17
5.6.120.0100.07721.02
5.6.110.0030.04321.02
5.6.100.0100.08021.14
5.6.90.0130.08320.88
5.6.80.0070.08720.49
5.5.350.0070.08720.41
5.5.340.0030.04717.94
5.5.330.0000.06020.42
5.5.320.0270.07720.24
5.5.310.0370.07320.34
5.5.300.0130.07018.01
5.5.290.0070.07018.08
5.5.280.0030.05720.96
5.5.270.0130.05720.77
5.5.260.0170.07020.77
5.5.250.0230.07720.69
5.5.240.0200.03020.28
5.4.450.0270.04319.57
5.4.440.0630.04019.32
5.4.430.0830.03319.19
5.4.420.0170.05319.52
5.4.410.0170.04719.58
5.4.400.0100.05319.22
5.4.390.0100.05019.14
5.4.380.0100.05319.12
5.4.370.0070.05719.11
5.4.360.0100.05019.04
5.4.350.0040.04212.02
5.4.340.0080.03512.02
5.4.320.0060.04012.51
5.4.310.0060.04012.50
5.4.300.0080.04312.51
5.4.290.0050.03812.50
5.4.280.0030.03812.39
5.4.270.0040.04012.40
5.4.260.0060.03912.39
5.4.250.0110.03712.40
5.4.240.0070.04712.40
5.4.230.0040.04812.39
5.4.220.0070.04212.39
5.4.210.0070.03812.39
5.4.200.0080.04612.39
5.4.190.0060.03912.39
5.4.180.0080.03512.38
5.4.170.0090.04312.40
5.4.160.0070.04312.39
5.4.150.0080.03912.38
5.4.140.0090.03912.07
5.4.130.0060.04012.06
5.4.120.0090.04512.02
5.4.110.0070.04612.01
5.4.100.0080.04412.01
5.4.90.0100.04012.01
5.4.80.0080.04512.01
5.4.70.0060.03912.01
5.4.60.0060.05212.00
5.4.50.0160.08312.01
5.4.40.0080.03811.99
5.4.30.0090.04211.99
5.4.20.0070.04012.00
5.4.10.0070.04011.99
5.4.00.0070.03911.48
5.3.290.0050.04112.80
5.3.280.0050.04412.71
5.3.270.0110.05012.72
5.3.260.0100.05012.72
5.3.250.0120.04712.72
5.3.240.0030.04712.72
5.3.230.0060.04412.71
5.3.220.0090.04812.68
5.3.210.0090.05212.68
5.3.200.0120.04512.68
5.3.190.0080.04912.68
5.3.180.0120.04512.68
5.3.170.0140.04512.67
5.3.160.0160.04112.67
5.3.150.0090.05012.67
5.3.140.0100.04812.66
5.3.130.0150.04512.66
5.3.120.0140.04612.66
5.3.110.0070.04512.65
5.3.100.0060.04212.13
5.3.90.0050.04612.11
5.3.80.0090.04112.09
5.3.70.0090.04112.09
5.3.60.0110.04512.09
5.3.50.0070.04812.02
5.3.40.0070.04912.02
5.3.30.0070.04611.98
5.3.20.0080.03611.76
5.3.10.0060.04011.74
5.3.00.0090.03711.72
5.2.170.0080.0329.22
5.2.160.0040.0359.22
5.2.150.0070.0299.22
5.2.140.0060.0309.21
5.2.130.0070.0289.18
5.2.120.0070.0289.18
5.2.110.0060.0339.18
5.2.100.0090.0299.17
5.2.90.0050.0319.18
5.2.80.0060.0339.17
5.2.70.0100.0309.18
5.2.60.0070.0309.13
5.2.50.0040.0319.10
5.2.40.0060.0319.07
5.2.30.0060.0319.05
5.2.20.0060.0319.04
5.2.10.0050.0488.95
5.2.00.0050.0328.81
5.1.60.0040.0308.09
5.1.50.0110.0258.09
5.1.40.0050.0338.07
5.1.30.0120.0288.42
5.1.20.0060.0278.44
5.1.10.0060.0288.16
5.1.00.0080.0268.16
5.0.50.0060.0206.64
5.0.40.0040.0256.51
5.0.30.0070.0316.31
5.0.20.0070.0266.29
5.0.10.0060.0256.27
5.0.00.0050.0326.25
4.4.90.0050.0154.78
4.4.80.0050.0224.75
4.4.70.0100.0334.75
4.4.60.0040.0214.76
4.4.50.0070.0184.77
4.4.40.0050.0324.71
4.4.30.0040.0214.76
4.4.20.0030.0234.85
4.4.10.0010.0244.85
4.4.00.0040.0324.76
4.3.110.0040.0224.66
4.3.100.0030.0224.66
4.3.90.0050.0204.63
4.3.80.0030.0274.58
4.3.70.0050.0134.63
4.3.60.0030.0154.63
4.3.50.0070.0184.62
4.3.40.0030.0254.54
4.3.30.0030.0153.30
4.3.20.0010.0183.28
4.3.10.0000.0173.24
4.3.00.0200.01013.30

preferences:
54.49 ms | 401 KiB | 5 Q