function kucult($text){
$search = array ('@Ğ@',
'/Ü/',
'/Ş/',
'/I/',
'/İ/',
'/Ö/',
'/Ç/');

$replace = array ('ğ',
'ü', 
'ş', 
'ı', 
'i',
'ö',
'ç'); 
$text = preg_replace($search, $replace, $text); 
$text = strtolower($text);
return($text);
}

function buyult($text){
$search = array ('/ğ/',
'/ü/', 
'/ş/', 
'/ı/', 
'/i/',
'/ö/',
'/ç/'); 

$replace = array ('Ğ',
'Ü',
'Ş',
'I',
'İ',
'Ö',
'Ç');
$text = strtolower($text);
$text = preg_replace($search, $replace, $text); 
$text = strtoupper($text);
return($text);
}

function uc_first($str)
{
	$str = kucult($str);
	$str2 = split(" ",$str);
	$str = "";
	for($i = 0; $i<sizeof($str2);$i++)
	 {
	  $str2[$i][0] = buyult($str2[$i][0]);
	  if($i != 0 && $str2[$i] != "")
	   $str .= " ";
	  if($str2[$i] != "" && !is_array($str2[$i]))
	   $str .= $str2[$i];
	 }
	 return $str;
}