Generate perfect slug (translit, iconv)

<?php
 
/* Idea from unused drupal patch http://drupal.org/node/63924 */
function generate_slug($str)
{
	// substitutes anything but letters, numbers and '_' with separator 
	$str = trim(preg_replace('~[^\\pL0-9_]+~u', '-', $str), "-");
 
	// HACK!! -- TRANSLIT cyrillic
	$str = strtr(mb_strtolower($str, 'UTF-8'), array(
	'а'=>'a','б'=>'b','в'=>'v','г'=>'g','д'=>'d','е'=>'e','ё'=>'yo',
	'ж'=>'zh','з'=>'z','и'=>'i','й'=>'y','к'=>'k','л'=>'l','м'=>'m',
	'н'=>'n','о'=>'o','п'=>'p','р'=>'r','с'=>'s','т'=>'t','у'=>'u',
	'ф'=>'f','х'=>'h','ц'=>'ts','ч'=>'ch','ш'=>'sh','щ'=>'sch',
	'ъ'=>"'",'ы'=>'yi','ь'=>'','э'=>'e','ю'=>'yu','я'=>'ya',
	'і'=>'i','ґ'=>'g','є'=>'e','ї'=>'yi','№'=>'#'  ));
 
	// TRANSLIT with iconv
	$str = iconv('utf-8', 'us-ascii//TRANSLIT', $str);
 
	// keep only letters, numbers, '_' and separator
	$str = preg_replace('~[^-a-z0-9_]+~', '', strtolower($str)); 
 
	return $str;
}
 
echo generate_slug("Кнопка/Button");
 
php?>
knopka-button