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에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4736 | jQuery | 8년 전 | 1558 | ||
| 4735 | jQuery | 8년 전 | 1746 | ||
| 4734 | jQuery | 8년 전 | 1735 | ||
| 4733 | jQuery | 8년 전 | 2032 | ||
| 4732 | jQuery | 8년 전 | 1955 | ||
| 4731 | jQuery | 8년 전 | 1459 | ||
| 4730 | jQuery | 8년 전 | 1915 | ||
| 4729 | PHP |
|
8년 전 | 6898 | |
| 4728 | jQuery | 8년 전 | 2561 | ||
| 4727 | jQuery | 8년 전 | 1610 | ||
| 4726 | jQuery | 8년 전 | 1689 | ||
| 4725 | jQuery | 8년 전 | 1833 | ||
| 4724 | jQuery | 8년 전 | 1310 | ||
| 4723 | jQuery | 8년 전 | 1861 | ||
| 4722 | jQuery | 8년 전 | 1624 | ||
| 4721 | jQuery | 8년 전 | 1917 | ||
| 4720 | jQuery | 8년 전 | 1974 | ||
| 4719 | jQuery | 8년 전 | 1601 | ||
| 4718 | jQuery | 8년 전 | 1607 | ||
| 4717 | jQuery | 8년 전 | 1558 | ||
| 4716 | jQuery | 8년 전 | 1235 | ||
| 4715 | jQuery | 8년 전 | 1391 | ||
| 4714 | jQuery | 8년 전 | 1414 | ||
| 4713 | jQuery | 8년 전 | 1333 | ||
| 4712 | jQuery | 8년 전 | 2226 | ||
| 4711 | jQuery | 8년 전 | 1708 | ||
| 4710 | PHP |
|
8년 전 | 3747 | |
| 4709 | jQuery | 8년 전 | 1629 | ||
| 4708 | jQuery | 8년 전 | 1906 | ||
| 4707 | jQuery | 8년 전 | 1759 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기