mixed str_word_count ( string str [, int count_type [, string char_list]] ) returns the number of words in a string : str_word_count « String « PHP






mixed str_word_count ( string str [, int count_type [, string char_list]] ) returns the number of words in a string

 
<?
    $str = "This is a test, only a test, and nothing but a test.";
    $a = str_word_count($str, 1);
    $b = str_word_count($str, 2);
    $c = str_word_count($str);
    print_r($a);
    print_r($b);
    echo "There are $c words in the string\n";
?>
  
  








Related examples in the same category

1.str_word_count-2.php
2.str_word_count.php