3v4l.org

run code in 300+ PHP versions simultaneously
<?php function slug( $string, $separator = '-' ) { $accents_regex = '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i'; $special_cases = array( '&' => 'and', "'" => ''); $string = mb_strtolower( trim( $string ), 'UTF-8' ); $string = str_replace( array_keys($special_cases), array_values( $special_cases), $string ); $string = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) ); $string = preg_replace("/\s+/", "$separator", $string); $string = preg_replace("/[$separator]+/u", "$separator", $string); return $string; } echo slug("um rĂ¡dio bonito");

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.0060.00324.09
8.4.110.0090.00922.20
8.4.100.0070.01417.98
8.4.90.0120.00818.44
8.4.80.0080.00819.62
8.4.70.0140.00618.05
8.4.60.0120.00818.80
8.4.50.0110.01219.71
8.4.40.0070.01319.64
8.4.30.0160.00320.45
8.4.20.0070.01320.34
8.4.10.0030.00619.72
8.3.250.0140.00518.94
8.3.240.0120.00716.77
8.3.230.0130.00716.73
8.3.220.0100.00816.98
8.3.210.0050.00316.68
8.3.200.0030.00516.54
8.3.190.0060.00317.05
8.3.180.0100.00918.71
8.3.170.0120.00618.99
8.3.160.0060.00316.86
8.3.150.0150.00320.84
8.3.140.0030.00617.15
8.3.130.0080.00018.66
8.3.120.0030.00620.70
8.3.110.0090.00016.63
8.3.100.0060.00318.57
8.3.90.0090.00916.69
8.3.80.0090.00018.43
8.3.70.0110.00416.63
8.3.60.0130.00718.56
8.3.50.0110.00618.09
8.3.40.0040.01118.84
8.3.30.0070.00718.79
8.3.20.0080.00021.77
8.3.10.0040.00420.69
8.3.00.0060.00319.38
8.2.290.0110.00620.45
8.2.280.0130.00918.65
8.2.270.0100.01017.18
8.2.260.0100.00720.57
8.2.250.0040.00416.76
8.2.240.0030.00617.10
8.2.230.0000.00920.94
8.2.220.0080.00024.06
8.2.210.0110.00326.77
8.2.200.0000.01018.54
8.2.190.0040.01218.46
8.2.180.0140.00718.54
8.2.170.0090.00619.04
8.2.160.0090.00622.96
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00418.09
8.2.120.0040.00426.35
8.2.110.0060.00320.35
8.2.100.0070.00417.97
8.2.90.0000.00817.75
8.2.80.0030.00617.97
8.2.70.0060.00318.04
8.2.60.0000.00918.05
8.2.50.0030.00518.10
8.2.40.0000.00821.06
8.2.30.0000.00719.19
8.2.20.0050.00218.03
8.2.10.0040.00419.52
8.2.00.0030.00518.09
8.1.330.0080.01223.85
8.1.320.0110.00918.10
8.1.310.0040.00416.72
8.1.300.0130.00716.21
8.1.290.0090.00018.88
8.1.280.0110.00425.92
8.1.270.0040.00420.28
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00023.78
8.1.230.0070.00419.07
8.1.220.0060.00317.79
8.1.210.0000.00920.27
8.1.200.0070.00317.47
8.1.190.0030.00617.38
8.1.180.0080.00318.10
8.1.170.0060.00318.91
8.1.160.0080.00019.00
8.1.150.0000.00818.91
8.1.140.0040.00420.37
8.1.130.0000.00820.42
8.1.120.0100.00017.53
8.1.110.0000.00817.50
8.1.100.0040.00417.68
8.1.90.0040.00417.52
8.1.80.0080.00017.54
8.1.70.0040.00417.64
8.1.60.0030.00617.81
8.1.50.0000.00817.77
8.1.40.0040.00417.72
8.1.30.0040.00417.80
8.1.20.0080.00017.88
8.1.10.0080.00017.79
8.1.00.0040.00417.64
8.0.300.0000.00719.66
8.0.290.0000.01017.13
8.0.280.0030.00518.62
8.0.270.0000.00717.24
8.0.260.0000.00618.55
8.0.250.0030.00317.09
8.0.240.0030.00617.18
8.0.230.0030.00317.25
8.0.220.0060.00317.14
8.0.210.0030.00317.30
8.0.200.0000.00817.23
8.0.190.0000.00717.28
8.0.180.0030.00517.21
8.0.170.0030.00617.16
8.0.160.0000.00717.17
8.0.150.0070.00017.16
8.0.140.0000.00717.18
8.0.130.0060.00013.56
8.0.120.0040.00417.06
8.0.110.0040.00417.25
8.0.100.0030.00517.04
8.0.90.0080.00016.96
8.0.80.0030.01317.13
8.0.70.0070.00017.02
8.0.60.0040.00417.18
8.0.50.0000.00817.18
8.0.30.0070.01217.40
8.0.20.0100.01017.47
8.0.10.0050.00317.11
8.0.00.0130.00717.01
7.4.330.0000.00515.55
7.4.320.0000.00916.75
7.4.300.0030.00316.79
7.4.290.0030.00316.89
7.4.280.0030.00516.77
7.4.270.0000.00716.89
7.4.260.0030.00516.77
7.4.250.0030.00316.75
7.4.240.0070.00016.82
7.4.230.0000.00816.83
7.4.220.0040.00417.00
7.4.210.0100.01016.79
7.4.200.0030.00316.82
7.4.160.0090.00716.81
7.4.140.0090.01017.86
7.4.130.0080.01116.67
7.4.120.0110.00616.58
7.4.110.0130.00616.86
7.4.100.0070.01416.93
7.4.90.0030.01316.70
7.4.80.0170.00719.39
7.4.70.0150.00916.71
7.4.60.0130.00316.57
7.4.50.0000.01216.57
7.4.40.0120.01216.64
7.4.00.0130.00515.22
7.3.330.0000.00513.71
7.3.320.0030.00313.51
7.3.310.0000.00816.66
7.3.300.0030.00316.58
7.3.290.0040.00416.66
7.3.280.0070.01016.67
7.3.260.0100.01016.70
7.3.240.0090.01016.70
7.3.230.0200.00316.76
7.3.210.0030.01616.53
7.3.200.0080.00816.54
7.3.190.0140.00616.52
7.3.180.0090.01016.85
7.3.170.0110.00716.68
7.3.160.0110.00916.53
7.3.120.0080.00714.99
7.3.110.0120.00615.22
7.3.100.0020.01215.33
7.3.90.0040.00914.87
7.3.80.0060.00515.12
7.3.70.0050.00714.89
7.3.60.0020.01315.12
7.3.50.0070.00914.92
7.3.40.0050.00815.01
7.3.30.0020.00714.89
7.3.20.3210.00815.71
7.3.10.3650.00915.68
7.3.00.2980.00815.72
7.2.330.0100.00716.75
7.2.320.0100.01016.93
7.2.310.0060.01016.87
7.2.300.0100.00716.91
7.2.290.0000.01616.74
7.2.250.0070.01215.32
7.2.240.0060.01115.15
7.2.230.0040.01215.07
7.2.220.0070.00715.38
7.2.210.0050.01115.20
7.2.200.0090.00315.21
7.2.190.0060.00815.07
7.2.180.0090.00515.31
7.2.170.0030.01015.28
7.2.150.6220.00815.19
7.2.140.6200.00315.25
7.2.130.8050.01315.18
7.2.120.8270.01015.19
7.2.110.6600.01315.35
7.2.100.6640.00814.93
7.2.90.6370.00815.02
7.2.80.6540.01215.18
7.2.70.5960.00715.02
7.2.60.5250.01515.23
7.2.50.5220.01315.06
7.2.40.5360.00615.14
7.2.30.5850.00515.16
7.2.20.4560.00615.16
7.2.10.4750.01015.18
7.2.00.3960.01115.07
7.1.330.0050.01016.09
7.1.320.0060.00816.04
7.1.310.0100.00316.10
7.1.300.0070.00815.88
7.1.290.0050.00615.80
7.1.280.0050.00816.03
7.1.270.0060.00615.74
7.1.260.0050.00816.22
7.1.250.8370.00514.06

preferences:
313.55 ms | 403 KiB | 5 Q