3v4l.org

run code in 300+ PHP versions simultaneously
<?php function slugify($title) { $output = ''; $valid_characters = 'abcdefghijklmnopqrstuvwxyz1234567890'; $len = strlen($title); for ($i = 0;$i < $len;$i++) { if (stripos($valid_characters, $title[$i]) !== FALSE) { // Letters and numbers are valid $output .= strtolower($title[$i]); } elseif ($i > 0 && $title[$i] !== '\'' && stripos($valid_characters, $title[$i - 1]) !== FALSE) { // Other characters are turned into dashes, but never two // in a row. $output .= '-'; } } if (substr($output, -1, 1) === '-') { return substr($output, 0, -1); } else { return $output; } } echo slugify('This is not a love song').PHP_EOL; echo slugify('There\'s a lady who is sure').PHP_EOL; echo slugify('All that is gold does not glitter ').PHP_EOL;

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.40.0060.00918.79
8.3.30.0070.01418.92
8.3.20.0040.00420.18
8.3.10.0040.00423.61
8.3.00.0040.00419.38
8.2.170.0170.00322.96
8.2.160.0090.00620.47
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0070.00726.16
8.2.120.0000.00821.04
8.2.110.0000.01122.25
8.2.100.0080.00418.34
8.2.90.0000.00819.30
8.2.80.0080.00017.97
8.2.70.0080.00317.63
8.2.60.0040.00417.93
8.2.50.0030.00618.07
8.2.40.0030.00518.16
8.2.30.0050.00219.43
8.2.20.0000.00717.83
8.2.10.0030.00518.10
8.2.00.0000.00917.63
8.1.270.0050.00323.83
8.1.260.0040.00426.35
8.1.250.0110.00728.09
8.1.240.0090.00024.02
8.1.230.0070.00318.97
8.1.220.0030.00617.74
8.1.210.0030.00518.77
8.1.200.0030.00917.35
8.1.190.0060.00317.13
8.1.180.0050.00318.10
8.1.170.0040.00418.50
8.1.160.0040.00422.09
8.1.150.0060.00318.95
8.1.140.0000.00817.34
8.1.130.0000.00717.74
8.1.120.0040.00417.53
8.1.110.0080.00017.41
8.1.100.0040.00417.43
8.1.90.0050.00217.38
8.1.80.0080.00017.45
8.1.70.0050.00217.32
8.1.60.0040.00417.53
8.1.50.0000.00917.52
8.1.40.0030.00517.42
8.1.30.0000.00817.66
8.1.20.0020.00517.73
8.1.10.0000.00817.61
8.1.00.0040.00417.55
8.0.300.0080.00018.77
8.0.290.0000.00716.63
8.0.280.0000.00918.50
8.0.270.0000.00717.23
8.0.260.0030.00317.27
8.0.250.0040.00416.90
8.0.240.0030.00316.86
8.0.230.0030.00516.86
8.0.220.0110.00016.88
8.0.210.0000.00716.87
8.0.200.0030.00316.94
8.0.190.0070.00016.86
8.0.180.0030.00316.87
8.0.170.0060.00316.99
8.0.160.0070.00016.96
8.0.150.0040.00416.86
8.0.140.0030.00516.78
8.0.130.0000.00513.32
8.0.120.0000.00916.76
8.0.110.0040.00416.90
8.0.100.0070.00016.76
8.0.90.0080.00016.85
8.0.80.0000.01516.89
8.0.70.0000.00716.97
8.0.60.0000.00716.78
8.0.50.0060.00316.94
8.0.30.0130.00717.12
8.0.20.0140.00817.40
8.0.10.0040.00416.99
8.0.00.0120.00516.62
7.4.330.0000.00515.14
7.4.320.0060.00016.58
7.4.300.0000.00616.45
7.4.290.0030.00316.38
7.4.280.0040.00416.41
7.4.270.0070.00016.63
7.4.260.0060.00316.64
7.4.250.0000.00716.47
7.4.240.0040.00316.64
7.4.230.0000.00716.63
7.4.220.0150.00316.64
7.4.210.0060.00916.64
7.4.200.0030.00516.73
7.4.160.0040.01116.50
7.4.150.0140.00317.40
7.4.140.0130.00417.86
7.4.130.0170.00116.41
7.4.120.0100.00716.56
7.4.110.0070.01016.61
7.4.100.0100.00716.49
7.4.90.0110.00616.61
7.4.80.0030.01719.39
7.4.70.0200.00316.57
7.4.60.0100.00716.25
7.4.50.0040.00416.62
7.4.40.0110.00616.56
7.4.30.0060.00916.58
7.4.00.0080.00815.10
7.3.330.0030.00313.38
7.3.320.0030.00313.37
7.3.310.0030.00316.32
7.3.300.0030.00316.42
7.3.290.0000.01416.34
7.3.280.0060.00916.36
7.3.270.0080.01117.40
7.3.260.0130.00316.40
7.3.250.0110.00716.55
7.3.240.0040.01516.65
7.3.230.0130.00316.50
7.3.210.0130.00316.32
7.3.200.0120.01319.39
7.3.190.0120.00616.27
7.3.180.0070.01316.41
7.3.170.0030.01216.38
7.3.160.0090.00616.58
7.3.120.0080.01214.64
7.3.110.0090.00915.11
7.3.100.0030.01314.84
7.3.90.0090.00315.05
7.3.80.0070.01114.59
7.3.70.0090.00014.65
7.3.60.0070.00314.99
7.3.50.0040.01514.87
7.3.40.0130.00614.93
7.3.30.0060.00614.74
7.3.20.0000.01616.86
7.3.10.0070.00416.77
7.3.00.0030.01316.80
7.2.330.0060.01116.61
7.2.320.0140.00316.64
7.2.310.0040.01416.82
7.2.300.0090.00916.70
7.2.290.0090.01616.88
7.2.250.0070.01015.28
7.2.240.0030.01215.22
7.2.230.0060.00914.88
7.2.220.0070.01015.09
7.2.210.0090.00915.25
7.2.200.0090.00315.03
7.2.190.0090.00315.20
7.2.180.0040.01215.09
7.2.170.0060.01215.21
7.2.00.0030.01019.59
7.1.330.0040.01115.68
7.1.320.0090.00315.83
7.1.310.0030.01015.88
7.1.300.0040.01215.76
7.1.290.0060.00915.91
7.1.280.0090.00916.00
7.1.270.0030.00615.85
7.1.260.0030.01415.57
7.1.100.0270.00617.88
7.1.70.0000.00816.87
7.1.60.0150.01119.46
7.1.50.0070.00716.99
7.1.00.0000.08022.45
7.0.200.0240.00716.79
7.0.140.0000.07722.12
7.0.60.0100.05319.95
7.0.50.0030.07317.91
7.0.40.0170.07720.15
7.0.30.0330.07720.20
7.0.20.0170.05020.15
7.0.10.0070.04320.30
7.0.00.0100.08320.07
5.6.280.0000.07321.01
5.6.210.0070.04720.57
5.6.200.0100.07318.23
5.6.190.0030.06720.63
5.6.180.0330.07320.46
5.6.170.0300.06720.71
5.6.160.0070.03720.54
5.6.150.0070.06718.14
5.6.140.0130.03018.18
5.6.130.0000.06018.21
5.6.120.0070.08720.98
5.6.110.0100.03721.04
5.6.100.0000.04721.05
5.6.90.0070.07721.12
5.6.80.0100.06020.40
5.5.350.0230.08020.41
5.5.340.0000.04318.03
5.5.330.0070.08720.47
5.5.320.0170.05320.25
5.5.310.0230.04720.18
5.5.300.0030.05017.98
5.5.290.0030.04317.98
5.5.280.0070.04320.85
5.5.270.0070.07320.80
5.5.260.0130.07320.96
5.5.250.0130.06720.80
5.5.240.0000.08320.18
5.4.450.0270.04719.57
5.4.440.0230.04719.39
5.4.430.0330.04019.54
5.4.420.0270.03019.19
5.4.410.0270.03319.35
5.4.400.0530.04019.09
5.4.390.0270.03319.32
5.4.380.0570.08318.51
5.4.370.0300.04718.60
5.4.360.0300.05018.78
5.4.350.0370.05018.61
5.4.340.0330.05318.77
5.4.320.0060.03612.51
5.4.310.0080.03612.50
5.4.300.0060.03612.50
5.4.290.0090.03512.50
5.4.280.0060.03512.40
5.4.270.0050.03712.40
5.4.260.0030.04112.40
5.4.250.0080.03612.39
5.4.240.0090.03412.40
5.4.230.0040.03912.39
5.4.220.0080.04312.39
5.4.210.0060.03612.39
5.4.200.0080.03612.39
5.4.190.0080.03412.39
5.4.180.0050.03812.39
5.4.170.0070.03712.40
5.4.160.0080.04012.39
5.4.150.0060.03512.38
5.4.140.0050.03812.07
5.4.130.0060.03712.06
5.4.120.0060.03512.02
5.4.110.0090.03212.01
5.4.100.0070.03412.02
5.4.90.0070.03612.01
5.4.80.0070.04312.02
5.4.70.0060.03612.01
5.4.60.0060.03512.01
5.4.50.0090.03712.00
5.4.40.0040.03712.00
5.4.30.0060.03612.00
5.4.20.0030.03911.99
5.4.10.0060.03512.00
5.4.00.0050.03711.48
5.3.290.0080.03812.80
5.3.280.0080.04212.71
5.3.270.0050.04612.72
5.3.260.0070.04512.72
5.3.250.0060.03812.72
5.3.240.0050.04012.72
5.3.230.0090.04012.71
5.3.220.0100.04312.68
5.3.210.0070.04012.68
5.3.200.0080.03512.68
5.3.190.0070.03812.68
5.3.180.0050.04812.67
5.3.170.0080.03812.67
5.3.160.0080.03712.67
5.3.150.0090.03612.67
5.3.140.0090.03512.66
5.3.130.0060.04112.66
5.3.120.0050.04412.66
5.3.110.0060.04212.65
5.3.100.0110.04012.12
5.3.90.0080.04412.10
5.3.80.0080.04112.09
5.3.70.0110.03712.09
5.3.60.0090.04012.07
5.3.50.0070.04012.02
5.3.40.0060.03612.02
5.3.30.0140.03711.98
5.3.20.0080.04011.76
5.3.10.0120.03611.73
5.3.00.0060.04111.72
5.2.170.0070.0399.22
5.2.160.0060.0299.21
5.2.150.0070.0369.22
5.2.140.0080.0299.21
5.2.130.0060.0369.18
5.2.120.0080.0319.17
5.2.110.0080.0319.18
5.2.100.0080.0339.18
5.2.90.0030.0399.18
5.2.80.0080.0379.18
5.2.70.0080.0349.17
5.2.60.0050.0359.13
5.2.50.0040.0359.09
5.2.40.0050.0389.07
5.2.30.0190.0559.05
5.2.20.0060.0339.03
5.2.10.0090.0358.94
5.2.00.0050.0358.81
5.1.60.0030.0258.09
5.1.50.0040.0258.08
5.1.40.0050.0238.07
5.1.30.0040.0318.41
5.1.20.0020.0348.43
5.1.10.0050.0258.16
5.1.00.0080.0228.16
5.0.50.0030.0286.65
5.0.40.0030.0196.52
5.0.30.0020.0316.33
5.0.20.0050.0216.29
5.0.10.0040.0196.28
5.0.00.0040.0296.27
4.4.90.0030.0144.78
4.4.80.0020.0154.76
4.4.70.0040.0144.75
4.4.60.0020.0154.75
4.4.50.0010.0174.77
4.4.40.0010.0274.71
4.4.30.0010.0174.76
4.4.20.0000.0184.84
4.4.10.0020.0174.85
4.4.00.0040.0244.76
4.3.110.0030.0164.67
4.3.100.0030.0154.66
4.3.90.0030.0144.64
4.3.80.0040.0234.59
4.3.70.0050.0124.63
4.3.60.0020.0154.63
4.3.50.0010.0174.63
4.3.40.0060.0214.54
4.3.30.0020.0163.32
4.3.20.0020.0163.30
4.3.10.0020.0153.25
4.3.00.0300.02016.04

preferences:
42.9 ms | 400 KiB | 5 Q