Util.php 206 B

123456789101112
  1. <?php
  2. namespace App;
  3. class Util {
  4. public static function slug(string $string, string $glue = "-"): string {
  5. $string = strtolower($string);
  6. return preg_replace("/[^a-z\d]+/i", $glue, $string);
  7. }
  8. }