/** * Generate a URL friendly slug from the given string * * @param string $string * @return string */ function str_slug($string, $glue = '-') { $normalized = str_remove_accents($string); $lower = strtolower($normalized); return preg_replace('/[\\W_]+/', $glue, $lower); }
/** * test str_remove_accents */ public function testStrRemoveAccents() { $this->assertSame('abcdehij', str_remove_accents('ábcdëhij')); }