Display the drop-down list

str_word_count()

« str_split | strcasecmp »
<?php
$mixed 
str_word_count (
    
// string $string
    
?// [int $format = 0]
    
  // [string $charlist]
);
?>
Result
$mixed = [
  
=> 'Hello',
  
=> 'fri',
  
=> 'nd',
  
=> 'you\'re',
  
=> 'looking',
  
=> 'good',
  
=> 'today',
]
Examples
#1 str_word_count  ("Hello fri3nd, you're looking good today!",
 
1)
#2 str_word_count  ("Hello fri3nd, you're looking good today!",
 
2)
#3 str_word_count  ("Hello fri3nd, you're looking good today!",
 
1,
 
"àáãç3")
See also
count_chars, explode, preg_split, substr_count