3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function clean($string) { $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens. $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. return strtolower(preg_replace('/-+/', '-', $string)); // Replaces multiple hyphens with single one. } echo clean("title---of-the-page");
based on 1ai89
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
title-of-the-page