3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex1 = "/[^0-9a-z\s]+/i"; // Search for everything that is not alphanumeric or whitespace $regex2 = "/\s+/"; // Search for whitespace $regex3 = "/-+$/"; // search for trailing dashes $text = "Hello World - This/That is (Test)"; // replace in turn, non-alpha with space, one or more spaces with dash, one or more trailing dashes with nothing $text2 = preg_replace([$regex1, $regex2, $regex3],[' ','-',''], $text); $text2 = strtolower($text2); echo $text2;

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.0090.00918.27
8.3.50.0160.00416.61
8.3.40.0090.00619.10
8.3.30.0110.00718.98
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.180.0200.00325.92
8.2.170.0060.00919.16
8.2.160.0120.00322.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00321.31
8.2.110.0070.00322.29
8.2.100.0040.00817.97
8.2.90.0040.00418.16
8.2.80.0000.00819.11
8.2.70.0040.00417.75
8.2.60.0030.00517.93
8.2.50.0000.00818.05
8.2.40.0040.00418.16
8.2.30.0080.00018.08
8.2.20.0000.00817.96
8.2.10.0050.00319.32
8.2.00.0000.00819.33
8.1.280.0150.00625.92
8.1.270.0080.00022.20
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00422.61
8.1.230.0080.00320.89
8.1.220.0000.00817.79
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0060.00317.35
8.1.180.0040.00418.10
8.1.170.0040.00418.83
8.1.160.0070.00018.98
8.1.150.0000.00718.91
8.1.140.0000.00718.95
8.1.130.0070.00020.16
8.1.120.0000.00717.63
8.1.110.0000.00717.62
8.1.100.0080.00017.64
8.1.90.0030.00417.57
8.1.80.0030.00717.57
8.1.70.0040.00417.49
8.1.60.0000.00817.77
8.1.50.0030.00617.63
8.1.40.0030.00617.70
8.1.30.0030.00617.78
8.1.20.0040.00417.76
8.1.10.0020.00517.55
8.1.00.0000.00817.57
8.0.300.0050.00220.07
8.0.290.0050.00316.88
8.0.280.0040.00418.50
8.0.270.0040.00418.20
8.0.260.0070.00018.42
8.0.250.0000.00717.07
8.0.240.0000.00717.12
8.0.230.0000.00717.00
8.0.220.0090.00017.11
8.0.210.0050.00317.02
8.0.200.0070.00016.97
8.0.190.0060.00317.09
8.0.180.0000.00716.95
8.0.170.0000.00817.04
8.0.160.0000.00716.94
8.0.150.0080.00016.96
8.0.140.0000.00917.08
8.0.130.0000.00613.44
8.0.120.0000.00716.89
8.0.110.0050.00216.93
8.0.100.0000.00816.83
8.0.90.0040.00417.00
8.0.80.0100.00617.05
8.0.70.0040.00417.03
8.0.60.0000.00817.13
8.0.50.0000.00817.07
8.0.30.0170.00317.01
8.0.20.0060.01017.10
8.0.10.0100.00717.10
8.0.00.0120.00917.17
7.4.330.0060.00015.55
7.4.320.0050.00216.86
7.4.300.0060.00016.70
7.4.290.0080.00016.73
7.4.280.0040.00416.80
7.4.270.0030.00516.86
7.4.260.0030.00313.54
7.4.250.0050.00316.79
7.4.240.0000.00816.79
7.4.230.0040.00416.73
7.4.220.0070.00016.67
7.4.210.0100.00316.67
7.4.200.0040.00416.82
7.4.160.0180.00016.80
7.4.150.0070.01416.75
7.4.140.0120.00316.81
7.4.130.0160.00016.70
7.4.120.0090.00916.56
7.4.110.0120.00616.71
7.4.100.0030.01316.62
7.4.90.0100.00616.79
7.4.80.0080.01116.82
7.4.70.0060.00916.75
7.4.60.0060.00916.81
7.4.50.0100.01016.65
7.4.40.0080.01216.66
7.4.30.0040.01616.74
7.4.20.0090.00616.65
7.4.10.0060.01216.65
7.4.00.0060.01216.76
7.3.330.0000.00716.36
7.3.320.0000.00613.22
7.3.310.0020.00616.34
7.3.300.0030.00316.10
7.3.290.0070.01116.34
7.3.270.0040.01516.37
7.3.260.0110.00416.45
7.3.250.0090.00616.37
7.3.240.0090.00616.40
7.3.230.0040.01416.28
7.3.220.0130.00316.32
7.3.210.0140.00316.30
7.3.200.0060.01116.30
7.3.190.0070.01416.34
7.3.180.0100.01016.23
7.3.170.0150.00016.27
7.3.160.0030.01716.22
7.3.150.0140.00616.31
7.3.140.0100.01016.33
7.3.130.0130.00316.20
7.3.120.0120.00916.33
7.3.110.0080.00816.19
7.3.100.0080.00816.21
7.3.90.0110.00416.66
7.3.80.0130.01016.30
7.3.70.0120.01116.42
7.3.60.0090.01316.49
7.3.50.0030.01616.50
7.3.40.0140.00716.41
7.3.30.0040.01116.42
7.3.20.0030.01216.46
7.3.10.0090.00916.45
7.3.00.0110.00416.43

preferences:
30.85 ms | 400 KiB | 5 Q