Created
October 12, 2013 10:24
-
-
Save jeonghwan-kim/6948397 to your computer and use it in GitHub Desktop.
한글 문자열 자르기
$text: 자를 문자열
$count: 잘라서 반환할 텍스트 길이
$more: 반환할 텍스트 마직막에 붙일 길고
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function cut_text($text, $count, $more = "...") { | |
| $length = mb_strlen($text, "UTF-8"); | |
| if($length <= $count) | |
| return $text; | |
| else | |
| return mb_substr($text, 0, $count, "UTF-8") . " " . $more; | |
| } | |
| echo cut_text('우리 나라 만세', 10); | |
| ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment