3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "(Here {is [a] Special} Title)! & it's fine, right?"; echo preg_replace('~[^a-z]~', '_', strtolower($string)); // all non-letters become underscores echo "\n\n"; echo str_replace(' ', '_', preg_replace('~[^a-z ]+~', '', strtolower($string))); // notice the consecutive underscores echo "\n\n"; echo preg_replace(['~[^a-z ]+~', '~ +~'], ['', '_'], strtolower($string)); // notice no consecutive underscores

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.4.120.0130.00720.44
8.4.110.0040.00718.70
8.4.100.0120.00917.85
8.4.90.0110.01017.87
8.4.80.0100.01018.13
8.4.70.0080.01017.95
8.4.60.0070.01118.63
8.4.50.0060.00717.89
8.4.40.0190.00019.67
8.4.30.0130.00719.71
8.4.20.0140.00720.43
8.4.10.0100.01017.71
8.3.250.0140.00518.84
8.3.240.0130.00716.82
8.3.230.0110.00516.61
8.3.220.0090.01016.82
8.3.210.0100.00816.65
8.3.200.0040.00516.66
8.3.190.0080.00817.07
8.3.180.0050.00716.79
8.3.170.0040.01417.01
8.3.160.0070.01118.49
8.3.150.0040.01517.19
8.3.140.0000.00816.79
8.3.130.0060.00318.42
8.3.120.0110.00820.60
8.3.110.0170.00320.94
8.3.100.0090.00624.06
8.3.90.0080.00026.77
8.3.80.0090.00316.49
8.3.70.0090.00618.43
8.3.60.0040.01518.30
8.3.50.0100.00418.46
8.3.40.0110.00418.78
8.3.30.0090.01318.56
8.3.20.0040.00421.91
8.3.10.0070.00021.73
8.3.00.0030.00519.65
8.2.290.0050.00518.70
8.2.280.0100.00920.17
8.2.270.0130.00716.86
8.2.260.0120.00618.91
8.2.250.0170.00316.66
8.2.240.0070.00317.27
8.2.230.0130.00622.58
8.2.220.0000.00937.54
8.2.210.0080.00026.77
8.2.200.0090.00616.63
8.2.190.0130.00316.88
8.2.180.0180.00318.41
8.2.170.0040.01122.96
8.2.160.0110.00720.35
8.2.150.0000.00825.66
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0050.00319.79
8.2.110.0000.01020.49
8.2.100.0080.00318.03
8.2.90.0060.00318.03
8.2.80.0060.00317.97
8.2.70.0070.00317.80
8.2.60.0040.00418.09
8.2.50.0000.00818.10
8.2.40.0000.00720.45
8.2.30.0000.00819.19
8.2.20.0080.00018.09
8.2.10.0040.00417.89
8.2.00.0000.00717.91
8.1.330.0120.00716.48
8.1.320.0110.00716.38
8.1.310.0030.00517.04
8.1.300.0040.00419.62
8.1.290.0030.00618.88
8.1.280.0160.00025.92
8.1.270.0040.00421.97
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0090.00623.92
8.1.230.0000.01122.20
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0000.00817.35
8.1.190.0060.00317.35
8.1.180.0060.00318.10
8.1.170.0060.00318.59
8.1.160.0050.00518.82
8.1.150.0000.00818.95
8.1.140.0040.00417.62
8.1.130.0000.00819.10
8.1.120.0070.00017.53
8.1.110.0040.00417.55
8.1.100.0040.00417.43
8.1.90.0040.00417.45
8.1.80.0000.00817.43
8.1.70.0000.00817.44
8.1.60.0000.00917.74
8.1.50.0080.00017.46
8.1.40.0050.00317.57
8.1.30.0030.00617.76
8.1.20.0040.00417.63
8.1.10.0050.00317.68
8.1.00.0040.00417.58
8.0.300.0040.00419.86
8.0.290.0040.00416.88
8.0.280.0060.00318.51
8.0.270.0000.00716.96
8.0.260.0060.00017.28
8.0.250.0040.00417.11
8.0.240.0000.00817.02
8.0.230.0040.00416.94
8.0.220.0070.00316.98
8.0.210.0000.00716.89
8.0.200.0030.00617.10
8.0.190.0040.00417.10
8.0.180.0000.00717.02
8.0.170.0050.00316.88
8.0.160.0040.00417.00
8.0.150.0040.00416.88
8.0.140.0040.00316.86
8.0.130.0030.00313.37
8.0.120.0040.00416.98
8.0.110.0050.00216.88
8.0.100.0000.00716.98
8.0.90.0000.00716.89
8.0.80.0040.01116.92
8.0.70.0000.00716.92
8.0.60.0040.00417.08
8.0.50.0040.00416.85
8.0.30.0110.00817.29
8.0.20.0130.00717.40
8.0.10.0000.00717.00
8.0.00.0110.00616.79
7.4.330.0000.00516.86
7.4.320.0070.00016.56
7.4.300.0030.00516.67
7.4.290.0070.00016.74
7.4.280.0000.00716.64
7.4.270.0070.00016.73
7.4.260.0070.00016.71
7.4.250.0000.00716.64
7.4.240.0080.00016.76
7.4.230.0000.00716.78
7.4.220.0040.00416.86
7.4.210.0070.00816.74
7.4.200.0030.00316.73
7.4.140.0090.01017.86
7.4.130.0130.00616.77
7.4.120.0090.00916.56
7.4.110.0110.00516.46
7.4.100.0120.01016.71
7.4.90.0060.01216.74
7.4.80.0090.00919.39
7.4.70.0070.01016.69
7.4.60.0030.01316.71
7.4.50.0100.00716.72
7.4.40.0100.00716.49
7.4.00.0060.00915.21
7.3.330.0020.00313.22
7.3.320.0000.00513.05
7.3.310.0000.00716.16
7.3.300.0030.00316.15
7.3.290.0000.00716.33
7.3.280.0060.01016.31
7.3.260.0060.01316.41
7.3.240.0120.00716.41
7.3.230.0120.00616.60
7.3.210.0100.01016.29
7.3.200.0070.01116.48
7.3.190.0060.01016.49
7.3.180.0060.01516.55
7.3.170.0090.00616.48
7.3.160.0130.00316.64
7.3.120.0100.00714.92
7.3.110.0030.01014.90
7.3.100.0070.00714.87
7.3.90.0000.01714.88
7.3.80.0070.01014.56
7.3.70.0080.00815.04
7.3.60.0030.01214.78
7.3.50.0130.00614.97
7.3.40.0000.01314.68
7.3.30.0100.00314.74
7.3.20.0030.01316.48
7.3.10.0090.00616.88
7.3.00.0060.00916.75
7.2.330.0040.01416.59
7.2.320.0070.01116.67
7.2.310.0190.00016.57
7.2.300.0060.01616.62
7.2.290.0040.02216.58
7.2.240.0040.01115.18
7.2.230.0110.00714.98
7.2.220.0070.01015.13
7.2.210.0060.00915.06
7.2.200.0060.00914.84
7.2.190.0100.00314.91
7.2.180.0090.00615.08
7.2.170.0070.00714.74
7.2.160.0030.01015.03
7.2.150.0040.00817.11
7.2.140.0030.00617.22
7.2.130.0050.00916.96
7.2.120.0070.00916.79
7.2.110.0080.00616.94
7.2.100.0030.01016.71
7.2.90.0090.00616.70
7.2.80.0070.00516.98
7.2.70.0080.00817.02
7.2.60.0050.00816.92
7.2.50.0040.00816.85
7.2.40.0330.00817.38
7.2.30.0320.01017.35
7.2.20.0400.00917.33
7.2.10.0370.01017.34
7.2.00.0300.01217.28
7.1.330.0070.00415.86
7.1.320.0060.00616.08
7.1.310.0070.00715.72
7.1.300.0140.00015.88
7.1.290.0100.00615.94
7.1.280.0070.00715.76
7.1.270.0060.00915.88
7.1.260.0030.00915.73
7.1.250.0030.00916.02
7.1.200.0060.00615.92
7.1.160.0710.00916.92
7.1.150.1000.01617.05
7.1.140.0950.01217.20
7.1.130.0610.01517.16
7.1.120.1140.01117.03
7.1.110.1030.01116.40
7.1.100.0710.01216.68
7.1.90.0920.00816.20
7.1.80.0950.01216.21
7.1.70.0710.00915.16
7.1.60.0930.01733.39
7.1.50.1230.01633.13
7.1.40.0960.01232.76
7.1.30.1060.01832.78
7.1.20.1300.01633.03
7.1.10.1360.01614.77
7.1.00.1270.01215.09

preferences:
35.28 ms | 403 KiB | 5 Q