3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sanitiseFilename($input) { // // See #3271 // Code from http://stackoverflow.com/a/2021729/3929494 // // Remove anything which isn't a word, whitespace, number // or any of the following characters -_~,;:[](). // If you don't need to handle multi-byte characters // you can use preg_replace rather than mb_ereg_replace // Thanks @Łukasz Rysiak! $output = mb_ereg_replace("([^\w\s\d\-_~,;:\[\]\(\).])", '', $input); // Remove any runs of periods (thanks falstro!) $output = mb_ereg_replace("([\.]{2,})", '', $output); // Remove any runs of spaces, e.g. " / " becomes " " which is ugly $output = mb_ereg_replace(" ", " ", $output); return $output; } echo sanitiseFilename("BBC/TVL") . PHP_EOL; echo sanitiseFilename("This%%% is an an$57noy£ing string/ to / use") . PHP_EOL; ?>

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.0120.00316.63
8.3.50.0110.00921.21
8.3.40.0070.00718.66
8.3.30.0040.01118.79
8.3.20.0070.00020.46
8.3.10.0000.00823.78
8.3.00.0000.00721.07
8.2.180.0150.00918.52
8.2.170.0120.00322.96
8.2.160.0000.01420.60
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0060.00321.13
8.2.120.0000.00926.35
8.2.110.0060.00322.25
8.2.100.0060.00617.93
8.2.90.0040.00419.36
8.2.80.0080.00018.05
8.2.70.0030.00617.88
8.2.60.0110.00017.80
8.2.50.0030.00518.07
8.2.40.0040.00422.44
8.2.30.0040.00420.71
8.2.20.0040.00417.93
8.2.10.0080.00018.08
8.2.00.0000.00718.11
8.1.280.0150.00625.92
8.1.270.0060.00320.51
8.1.260.0040.00428.09
8.1.250.0080.00028.09
8.1.240.0070.00322.59
8.1.230.0040.00819.16
8.1.220.0000.00817.88
8.1.210.0040.00418.77
8.1.200.0100.00017.48
8.1.190.0060.00317.36
8.1.180.0060.00318.10
8.1.170.0030.00518.75
8.1.160.0040.00421.00
8.1.150.0050.00219.13
8.1.140.0060.00319.82
8.1.130.0000.00717.91
8.1.120.0000.00817.67
8.1.110.0060.00317.61
8.1.100.0040.00417.70
8.1.90.0030.00517.52
8.1.80.0050.00317.62
8.1.70.0000.00817.67
8.1.60.0040.00417.74
8.1.50.0070.00017.66
8.1.40.0040.00417.75
8.1.30.0040.00417.82
8.1.20.0060.00317.88
8.1.10.0040.00417.67
8.1.00.0070.00317.61
8.0.300.0050.00218.77
8.0.290.0000.00816.63
8.0.280.0040.00418.51
8.0.270.0050.00217.45
8.0.260.0000.00717.46
8.0.250.0030.00317.16
8.0.240.0000.00717.05
8.0.230.0030.00317.11
8.0.220.0000.00817.12
8.0.210.0050.00316.99
8.0.200.0060.00017.07
8.0.190.0050.00517.16
8.0.180.0030.00517.00
8.0.170.0070.00017.17
8.0.160.0040.00417.19
8.0.150.0030.00517.02
8.0.140.0080.00016.97
8.0.130.0000.00813.51
8.0.120.0000.00817.00
8.0.110.0040.00417.09
8.0.100.0000.00817.04
8.0.90.0020.00516.92
8.0.80.0060.01017.16
8.0.70.0040.00416.91
8.0.60.0000.00716.90
8.0.50.0000.00716.91
8.0.30.0140.01117.27
8.0.20.0090.01017.40
8.0.10.0040.00417.14
8.0.00.0130.00616.99
7.4.330.0000.00516.84
7.4.320.0060.00016.63
7.4.300.0030.00316.85
7.4.290.0030.00316.75
7.4.280.0050.00316.68
7.4.270.0040.00416.73
7.4.260.0080.00016.70
7.4.250.0030.00516.77
7.4.240.0050.00216.72
7.4.230.0070.00016.91
7.4.220.0100.01616.78
7.4.210.0060.01216.86
7.4.200.0040.00416.65
7.4.160.0050.01116.59
7.4.150.0130.00617.40
7.4.140.0110.01217.86
7.4.130.0100.00716.65
7.4.120.0090.00916.79
7.4.110.0100.01016.72
7.4.100.0150.00316.70
7.4.90.0090.00916.61
7.4.80.0110.00719.39
7.4.70.0060.01016.63
7.4.60.0120.00416.71
7.4.50.0070.01116.56
7.4.40.0070.01016.70
7.4.30.0030.01616.64
7.4.00.0100.00715.09
7.3.330.0060.00013.39
7.3.320.0080.00013.30
7.3.310.0040.00416.23
7.3.300.0050.00516.37
7.3.290.0070.00016.34
7.3.280.0070.01116.32
7.3.270.0110.01117.40
7.3.260.0060.01116.51
7.3.250.0090.01016.49
7.3.240.0130.00416.53
7.3.230.0070.01016.48
7.3.210.0120.00616.49
7.3.200.0070.01016.30
7.3.190.0060.01716.39
7.3.180.0060.01016.58
7.3.170.0080.01116.46
7.3.160.0030.02016.33
7.2.330.0090.01216.80
7.2.320.0120.00916.79
7.2.310.0090.01216.46
7.2.300.0060.01516.52
7.2.290.0090.00916.56
7.2.00.0070.00419.13
7.1.100.0060.00617.83
7.1.70.0000.00917.26
7.1.60.0030.02019.52
7.1.50.0100.01416.96
7.1.00.0000.07722.29
7.0.200.0060.00316.50
7.0.60.0130.07319.95
7.0.50.0130.08317.91
7.0.40.0100.04720.15
7.0.30.0400.08320.14
7.0.20.0330.08020.18
7.0.10.0100.08720.14
7.0.00.0070.03720.25
5.6.280.0000.04320.92
5.6.210.0130.07020.63
5.6.200.0070.07018.31
5.6.190.0030.06320.49
5.6.180.0230.08020.50
5.6.170.0330.07720.57
5.6.160.0000.04320.45
5.6.150.0030.05718.18
5.6.140.0100.03718.25
5.6.130.0030.08018.17
5.6.120.0000.04721.01
5.6.110.0100.04321.14
5.6.100.0030.04021.04
5.6.90.0100.03320.96
5.6.80.0100.03320.42
5.5.350.4230.04020.41
5.5.340.0100.03317.97
5.5.330.0070.08720.40
5.5.320.0400.05020.40
5.5.310.0200.03720.25
5.5.300.0170.07717.94
5.5.290.0100.06017.97
5.5.280.0130.08020.72
5.5.270.0000.05020.84
5.5.260.0130.07720.98
5.5.250.0100.08320.50
5.5.240.0070.07320.29

preferences:
59.2 ms | 401 KiB | 5 Q