3v4l.org

run code in 300+ PHP versions simultaneously
<?php static public function slugify($text) { // replace non letter or digits by - $text = preg_replace('~[^\\pL\d]+~u', '-', $text); // trim $text = trim($text, '-'); // transliterate $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); // lowercase $text = strtolower($text); // remove unwanted characters $text = preg_replace('~[^-\w]+~', '', $text); if (empty($text)) { return 'n-a'; } return $text; } echo slugify('šđčćž ŠĐČĆŽ') ?>

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)
7.0.20.0230.08320.30
7.0.10.0100.08720.20
7.0.00.0000.04320.07
5.6.170.0300.08020.53
5.6.160.0100.07718.18
5.6.150.0030.04018.16
5.6.140.0030.05018.15
5.6.130.0070.08318.15
5.6.120.0070.07721.12
5.6.110.0170.05720.93
5.6.100.0130.08320.98
5.6.90.0000.08020.99
5.6.80.0070.08020.50
5.5.310.0330.07720.41
5.5.300.0000.08018.08
5.5.290.0000.05717.95
5.5.280.0170.06020.84
5.5.270.0070.08720.78
5.5.260.0030.09020.79
5.5.250.0030.09320.77
5.5.240.0230.07320.23

preferences:
140.63 ms | 1394 KiB | 7 Q