1
0
mirror of synced 2024-12-15 15:46:02 +03:00
doctrine2/website/lib/Common.class.php
2007-09-06 17:21:56 +00:00

20 lines
414 B
PHP

<?php
class Common
{
public static function createSlug($text)
{
$text = strtolower($text);
// strip all non word chars
$text = preg_replace('/\W/', ' ', $text);
// replace all white space sections with a dash
$text = preg_replace('/\ +/', '-', $text);
// trim dashes
$text = preg_replace('/\-$/', '', $text);
$text = preg_replace('/^\-/', '', $text);
return $text;
}
}