How To Count Words In Php?

Discussion in 'PHP' started by Rinoy, Feb 18, 2013.

  1. #1
    I want to count the number of words in a string. But it should be accurate even if it contains (,;':"/) or any other symbol.
     
    Solved! View solution.
    Rinoy, Feb 18, 2013 IP
  2. #2
    Use str_word_count();

    Example:
    $count = str_word_count($string);

    http://php.net/manual/en/function.str-word-count.php
     
    Graex, Feb 18, 2013 IP
  3. Rinoy

    Rinoy Well-Known Member

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    106
    #3
    thanks Graex
     
    Rinoy, Feb 18, 2013 IP