Revision: 10294
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 16, 2008 16:02 by Zver
Initial Code
public function getStrippedTitle() { $result = strtolower($this->getTitle()); // strip all non word chars $result = preg_replace('/\W/', ' ', $result); // replace all white space sections with a dash $result = preg_replace('/\ +/', '-', $result); // trim dashes $result = preg_replace('/\-$/', '', $result); $result = preg_replace('/^\-/', '', $result); return $result; }
Initial URL
Initial Description
This helps you stip anything from title. This example is from Symfony homepage.
Initial Title
getStrippedTitle
Initial Tags
regex
Initial Language
PHP