3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stripSpecialCharater($string) { return preg_replace(['/\s{2,}|[\t\R]/u', '/[^a-z\d\s&‚~§©ÂÃ⃀-]/ui'], [' ', ''], $string); //$string = iconv("Windows-1252","UTF-8",urldecode($string)); //$string = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $string); //return preg_replace('/[^a-zA-Z0-9ç&-©‚ƒ‘\s]/', '', $string); } $tests = ['12 34', 'adsf', 'co©', 'pound £']; foreach ($tests as $test) { echo "$test : "; var_export(stripSpecialCharater($test)); echo "\n"; }

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.00418.48
8.3.50.0110.00416.22
8.3.40.0060.00918.67
8.3.30.0040.01118.71
8.3.20.0050.00321.73
8.3.10.0050.00320.61
8.3.00.0040.00419.30
8.2.180.0090.00618.67
8.2.170.0070.01022.96
8.2.160.0170.00320.43
8.2.150.0000.00824.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0110.00419.62
8.2.110.0000.01121.13
8.2.100.0040.00717.84
8.2.90.0040.00419.13
8.2.80.0000.00817.97
8.2.70.0000.00817.50
8.2.60.0040.00417.93
8.2.50.0000.00918.07
8.2.40.0040.00418.16
8.2.30.0070.00418.11
8.2.20.0040.00417.91
8.2.10.0040.00419.47
8.2.00.0040.00418.08
8.1.280.0060.00925.92
8.1.270.0060.00320.29
8.1.260.0030.00526.35
8.1.250.0080.00028.09
8.1.240.0000.00921.30
8.1.230.0090.00317.46
8.1.220.0000.00917.74
8.1.210.0050.00318.77
8.1.200.0040.00717.23
8.1.190.0080.00017.10
8.1.180.0050.00318.10
8.1.170.0080.00018.44
8.1.160.0040.00418.86
8.1.150.0000.00818.89
8.1.140.0070.00020.17
8.1.130.0030.00320.13
8.1.120.0040.00417.52
8.1.110.0000.00717.43
8.1.100.0000.00717.34
8.1.90.0050.00217.45
8.1.80.0070.00017.35
8.1.70.0040.00417.43
8.1.60.0000.00917.62
8.1.50.0040.00417.48
8.1.40.0040.00417.50
8.1.30.0000.00817.68
8.1.20.0040.00817.57
8.1.10.0070.00017.38
8.1.00.0020.00517.39
8.0.300.0000.00718.77
8.0.290.0000.00716.88
8.0.280.0000.00718.45
8.0.270.0050.00216.87
8.0.260.0070.00018.45
8.0.250.0000.00817.02
8.0.240.0040.00417.06
8.0.230.0030.00316.88
8.0.220.0000.00716.92
8.0.210.0000.00816.84
8.0.200.0000.00816.84
8.0.190.0040.00416.95
8.0.180.0030.00517.00
8.0.170.0030.00617.05
8.0.160.0040.00416.93
8.0.150.0080.00016.96
8.0.140.0040.00416.87
8.0.130.0050.00013.33
8.0.120.0030.00516.96
8.0.110.0040.00416.84
8.0.100.0070.00016.79
8.0.90.0030.00616.82
8.0.80.0110.00916.88
8.0.70.0070.00016.83
8.0.60.0000.00716.79
8.0.50.0000.00716.83
8.0.30.0110.00616.93
8.0.20.0110.00716.96
8.0.10.0040.00416.90
8.0.00.0100.01016.87
7.4.330.0000.00615.55
7.4.320.0040.00416.66
7.4.300.0000.00616.65
7.4.290.0000.00716.67
7.4.280.0030.00616.58
7.4.270.0040.00716.71
7.4.260.0000.00816.56
7.4.250.0040.00416.61
7.4.240.0000.00716.64
7.4.230.0000.00716.35
7.4.220.0050.00316.74
7.4.210.0130.00516.57
7.4.200.0000.00816.48
7.4.160.0110.00616.59
7.4.140.0110.00717.86
7.4.130.0060.01116.62
7.4.120.0070.01316.57
7.4.110.0110.00616.65
7.4.100.0170.00716.42
7.4.90.0090.00916.63
7.4.80.0100.01019.39
7.4.70.0030.01416.73
7.4.60.0060.00916.61
7.4.50.0100.00316.56
7.4.40.0090.00916.62
7.4.00.0040.01114.93
7.3.330.0000.00513.43
7.3.320.0030.00313.32
7.3.310.0050.00216.51
7.3.300.0030.00316.45
7.3.290.0030.00316.48
7.3.280.0100.00616.48
7.3.260.0070.01116.63
7.3.240.0080.01116.59
7.3.230.0060.01116.90
7.3.210.0030.01416.63
7.3.200.0030.01416.56
7.3.190.0070.01016.80
7.3.180.0120.00316.60
7.3.170.0060.01216.58
7.3.160.0140.01016.71
7.3.120.0040.01215.24
7.3.110.0080.00814.77
7.3.100.0060.00615.34
7.3.90.0040.00815.02
7.3.80.0070.00314.88
7.3.70.0090.00315.20
7.3.60.0070.00315.04
7.3.50.0040.01114.83
7.3.40.0000.00915.14
7.3.30.0030.01015.13
7.3.20.0210.00515.83
7.3.10.0170.00815.99
7.3.00.0210.00515.87
7.2.330.0070.01816.79
7.2.320.0060.01216.86
7.2.310.0160.00316.88
7.2.300.0060.01116.66
7.2.290.0090.00616.80
7.2.240.0040.01414.96
7.2.230.0000.01515.25
7.2.220.0030.01415.27
7.2.210.0140.00315.36
7.2.200.0110.00315.19
7.2.190.0070.01015.28
7.2.180.0090.00615.13
7.2.170.0000.01615.33
7.2.160.0030.01014.86
7.2.150.0280.00315.90
7.2.140.0180.01016.21
7.2.130.0250.00516.13
7.2.120.0220.00916.07
7.2.110.0200.00315.97
7.2.100.0230.01116.04
7.2.90.0240.00716.09
7.2.80.0220.00916.11
7.2.70.0220.00716.24
7.2.60.0170.00816.19
7.2.50.0620.00816.15
7.2.40.0270.00716.11
7.2.30.0180.00716.19
7.2.20.0290.00616.28
7.2.10.0260.00816.04
7.2.00.0220.01116.08
7.1.330.0100.00716.20
7.1.320.0030.01016.22
7.1.310.0000.01216.04
7.1.300.0030.00615.72
7.1.290.0060.00915.75
7.1.280.0000.01116.12
7.1.270.0140.00015.97
7.1.260.0100.00315.72
7.1.250.0160.00915.00

preferences:
69.77 ms | 400 KiB | 5 Q