3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Slug($string){ $result = preg_replace("/[^A-Za-z0-9./\-_~]/", '', $string); return $result; /*return trim(preg_replace('~[^0-9a-zA-Z]+~i', '-', html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8')), '-');*/ } $user = 'Cómo hablar en sílabas'; var_dump(Slug($user)); // como-hablar-en-silabas $user = 'Álix Ãxel'; var_dump(Slug($user)); // alix-axel $user = 'Álix----_Ãxel!?!?'; var_dump(Slug($user)); // alix-axel

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.59
8.3.50.0140.00018.05
8.3.40.0060.00918.66
8.3.30.0040.01118.79
8.3.20.0080.00021.66
8.3.10.0040.00423.66
8.3.00.0050.00319.56
8.2.180.0140.00018.29
8.2.170.0100.01022.96
8.2.160.0070.00720.35
8.2.150.0120.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00720.57
8.2.120.0050.00226.35
8.2.110.0030.00619.45
8.2.100.0040.00717.91
8.2.90.0030.00519.09
8.2.80.0040.00417.97
8.2.70.0050.00317.93
8.2.60.0060.00317.80
8.2.50.0030.00519.13
8.2.40.0000.00720.43
8.2.30.0050.00219.12
8.2.20.0030.00517.99
8.2.10.0070.00018.05
8.2.00.0040.00417.97
8.1.280.0070.01025.92
8.1.270.0000.00718.79
8.1.260.0080.00026.35
8.1.250.0030.00628.09
8.1.240.0070.00321.27
8.1.230.0070.00418.80
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0000.01117.10
8.1.180.0040.00418.10
8.1.170.0080.00020.54
8.1.160.0030.00518.83
8.1.150.0050.00220.23
8.1.140.0000.00719.51
8.1.130.0040.00417.30
8.1.120.0000.00717.30
8.1.110.0040.00417.34
8.1.100.0030.00517.38
8.1.90.0000.00717.41
8.1.80.0000.00817.41
8.1.70.0050.00317.37
8.1.60.0030.00517.54
8.1.50.0030.00517.43
8.1.40.0050.00317.46
8.1.30.0040.00417.65
8.1.20.0050.00317.69
8.1.10.0040.00417.47
8.1.00.0000.00817.28
8.0.300.0040.00418.78
8.0.290.0110.00016.75
8.0.280.0000.00718.50
8.0.270.0030.00317.11
8.0.260.0000.00616.78
8.0.250.0000.00716.93
8.0.240.0000.00716.83
8.0.230.0000.00716.93
8.0.220.0040.00416.98
8.0.210.0030.00316.89
8.0.200.0000.00817.02
8.0.190.0040.00417.00
8.0.180.0040.00416.91
8.0.170.0000.00716.95
8.0.160.0000.00716.90
8.0.150.0000.00816.79
8.0.140.0000.00716.84
8.0.130.0030.00313.37
8.0.120.0050.00316.82
8.0.110.0040.00416.85
8.0.100.0080.00016.78
8.0.90.0050.00316.84
8.0.80.0030.01216.85
8.0.70.0020.00516.84
8.0.60.0070.00016.71
8.0.50.0000.00716.79
8.0.30.0110.00916.95
8.0.20.0100.00817.40
8.0.10.0020.00517.09
8.0.00.0080.00816.76
7.4.330.0000.00715.55
7.4.320.0000.00616.49
7.4.300.0060.00016.51
7.4.290.0070.00016.44
7.4.280.0060.00316.49
7.4.270.0000.00716.59
7.4.260.0110.00016.59
7.4.250.0050.00316.57
7.4.240.0000.00816.52
7.4.230.0030.00316.55
7.4.220.0040.01516.45
7.4.210.0030.01016.50
7.4.200.0030.00316.40
7.4.160.0090.00716.64
7.4.150.0150.00317.40
7.4.140.0110.00817.86
7.4.130.0120.01216.42
7.4.120.0090.01216.43
7.4.110.0170.00016.32
7.4.100.0150.00316.57
7.4.90.0130.00316.43
7.4.80.0070.01019.39
7.4.70.0030.01316.66
7.4.60.0090.00916.51
7.4.50.0080.00816.46
7.4.40.0100.00716.64
7.4.30.0120.00916.54
7.4.00.0070.00714.91
7.3.330.0040.00413.17
7.3.320.0030.00313.28
7.3.310.0030.00616.27
7.3.300.0060.00016.16
7.3.290.0090.00616.30
7.3.280.0080.00916.31
7.3.270.0120.00617.40
7.3.260.0140.00616.36
7.3.250.0090.01016.48
7.3.240.0130.00516.41
7.3.230.0110.00616.59
7.3.210.0110.00616.36
7.3.200.0000.01516.44
7.3.190.0090.01016.38
7.3.180.0060.01416.48
7.3.170.0130.00616.26
7.3.160.0090.00616.34
7.2.330.0100.00716.70
7.2.320.0100.00616.64
7.2.310.0100.01216.44
7.2.300.0030.01416.35
7.2.290.0060.01216.58
7.2.110.0080.00816.29
7.2.100.0140.00016.55
7.2.90.0120.00316.51
7.2.80.0090.00616.73
7.2.70.0080.00816.79
7.2.60.0130.00216.71
7.2.50.0080.00816.79
7.2.40.0300.00016.77
7.2.30.0270.01016.70
7.2.20.0030.01316.68
7.2.10.0280.00916.89
7.2.00.0110.00416.98
7.1.230.0120.00315.42
7.1.220.2240.00315.70
7.1.210.0150.00315.68
7.1.200.0100.00315.70
7.1.190.0090.00615.61
7.1.180.0110.00315.62
7.1.170.0090.00515.67
7.1.160.0120.00515.65
7.1.150.0250.01415.71
7.1.140.0080.00815.88
7.1.130.0090.00615.81
7.1.120.0270.00315.38
7.1.110.0140.00015.68
7.1.100.0060.00615.82
7.1.90.0070.00715.79
7.1.80.0100.00515.70
7.1.70.0050.00716.46
7.1.60.0460.01224.45
7.1.50.0460.01124.31
7.1.40.0770.01624.20
7.1.30.0500.01024.21
7.1.20.0490.01424.34
7.1.10.0380.01015.15
7.1.00.0430.00915.21
7.0.310.0280.00715.28
7.0.300.0080.00315.24
7.0.290.0090.00515.26
7.0.280.0060.00615.09
7.0.270.0090.00215.41
7.0.260.0120.00315.26
7.0.250.0120.00215.11
7.0.240.0110.00315.05
7.0.230.0120.00615.27
7.0.220.0120.00415.52
7.0.210.0060.01015.41
7.0.200.0380.01114.98
7.0.190.0380.00614.86
7.0.180.0530.00514.72
7.0.170.0650.01214.88
7.0.160.0480.00814.89
7.0.150.0400.00714.86
7.0.140.0510.00614.86
7.0.130.0280.00814.93
7.0.120.0320.00715.01
7.0.110.0380.01514.84
7.0.100.0290.00914.93
7.0.90.0280.00914.74
7.0.80.0280.00414.82
7.0.70.0320.00314.75
7.0.60.0290.00714.82
7.0.50.0280.00515.07
7.0.40.0340.00614.11
7.0.30.0260.00813.90
7.0.20.0300.00713.79
7.0.10.0250.00813.92
7.0.00.0250.00813.79
5.6.380.0080.00914.52

preferences:
58.25 ms | 401 KiB | 5 Q