str_word_count - 문자열에 사용 된 단어에 대한 정보를 반환합니다.
str_word_count - 문자열에 사용 된 단어에 대한 정보를 반환합니다.
설명 ¶
mixed str_word_count ( string $string [, int $format= 0 [, string $charlist ]])
내부 단어 수를 센다 string. 옵션 format이 지정되지 않으면 반환 값은 발견 된 단어의 수를 나타내는 정수가됩니다. the format가 지정된 경우 반환 값은 배열이며 그 내용은에 따라 다릅니다 format. the format및 결과 출력 의 가능한 값 은 다음과 같습니다.
이 함수의 목적을 위해 'word'는 알파벳 문자를 포함하는 로케일 종속 문자열로 정의됩니다.이 문자열에는 " '"및 "-"문자가 포함될 수 있지만 시작할 수 없습니다.
매개 변수 ¶
string
문자열
format
이 함수의 반환 값을 지정하십시오. 현재 지원되는 값은 다음과 같습니다.
0 - 발견 된 단어의 수를 반환합니다.
1 - 내부에있는 모든 단어를 포함하는 배열을 반환합니다. string
2 - 연관 배열을 반환합니다. 여기서 키는 안에있는 단어의 숫자 위치이고 string값은 실제 단어 자체입니다.
charlist
'단어'로 간주 될 추가 문자 목록
반환 값 ¶
format선택한 배열에 따라 배열 또는 정수를 반환합니다 .
변경 내역 ¶
번역 기술
5.1.0 charlist매개 변수 추가
예 ¶
Example # 1 str_word_count () 예제
<?php
$str = "Hello fri3nd, you're
looking good today!";
print_r(str_word_count($str, 1));
print_r(str_word_count($str, 2));
print_r(str_word_count($str, 1, 'àáãç3'));
echo str_word_count($str);
?>
Array
(
[0] => Hello
[1] => fri
[2] => nd
[3] => you're
[4] => looking
[5] => good
[6] => today
)
Array
(
[0] => Hello
[6] => fri
[10] => nd
[14] => you're
[29] => looking
[46] => good
[51] => today
)
Array
(
[0] => Hello
[1] => fri3nd
[2] => you're
[3] => looking
[4] => good
[5] => today
)
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4706 | jQuery | 8년 전 | 1514 | ||
| 4705 | jQuery | 8년 전 | 2169 | ||
| 4704 | jQuery | 8년 전 | 1704 | ||
| 4703 | jQuery | 8년 전 | 2041 | ||
| 4702 | jQuery | 8년 전 | 1831 | ||
| 4701 | jQuery | 8년 전 | 2062 | ||
| 4700 | jQuery | 8년 전 | 1743 | ||
| 4699 | jQuery | 8년 전 | 1528 | ||
| 4698 | jQuery | 8년 전 | 1337 | ||
| 4697 | jQuery | 8년 전 | 1753 | ||
| 4696 | jQuery | 8년 전 | 2372 | ||
| 4695 | jQuery | 8년 전 | 1388 | ||
| 4694 | jQuery | 8년 전 | 1797 | ||
| 4693 | jQuery | 8년 전 | 1775 | ||
| 4692 | jQuery | 8년 전 | 2566 | ||
| 4691 | jQuery | 8년 전 | 2072 | ||
| 4690 | jQuery | 8년 전 | 1964 | ||
| 4689 | jQuery | 8년 전 | 1942 | ||
| 4688 | jQuery | 8년 전 | 1703 | ||
| 4687 | jQuery | 8년 전 | 1118 | ||
| 4686 | jQuery | 8년 전 | 1749 | ||
| 4685 | jQuery | 8년 전 | 2493 | ||
| 4684 | jQuery | 8년 전 | 2372 | ||
| 4683 | jQuery | 8년 전 | 1765 | ||
| 4682 | PHP | 8년 전 | 3086 | ||
| 4681 | jQuery | 8년 전 | 1608 | ||
| 4680 | jQuery | 8년 전 | 1791 | ||
| 4679 | PHP | 8년 전 | 2020 | ||
| 4678 | PHP | 8년 전 | 2150 | ||
| 4677 | PHP | 8년 전 | 2257 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기