euckr로 된 한글일 경우에는

 

 $tmp_user_name = iconv("euckr","utf8",$user_name);      //치환을 할려고 euckr를 utf8로
 $tmp2_user_name = preg_replace('/(^.)./u', '$1*', $tmp_user_name);  //가운데문자 치환
 $tmp3_user_name = iconv("utf8","euckr",$tmp2_user_name);    //치환문자를 다시 euckr로

 

 한글 자체를 utf8로 변경해서 치환 후 다시 euckr로 변경을 하면 된다.

 

 euckr에서 한글 쪼개기를 하면 다른 문자로 쪼개긴다.

 

 iconv는 php컴파일시 추가해줘야 하는 사항이다.

 

 phpinfo()로 확인 가능함.