(PHP 4 >= 4.3.0, PHP 5, PHP 7)
str_word_count — �����ַ����е��ʵ�ʹ�����
ͳ�� string �е��ʵ������������ѡ�IJ��� format û�б�ָ������ô����ֵ��һ�������������������������ָ���� format ����������ֵ����һ�����飬�����������ȡ���� format ������format �Ŀ���ֵ����Ӧ���������������С�
�������������Ŀ����˵�����ʵĶ�����һ��������������ص��ַ���������ַ�����������ĸ�ַ���Ҳ������ "'" �� "-" �ַ������������������ַ���ʼ����
string�ַ�����
formatָ�������ķ���ֵ����ǰ֧�ֵ�ֵ���£�
string ��ȫ�����ʵ�����
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
)
7