Supporting special characters with str_word_count()

前端 未结 4 848
醉梦人生
醉梦人生 2021-02-20 06:36

The str_word_count() function returns an array that holds all words in a string. It works great, except when using special characters. In this case, the php script receives the

4条回答
  •  星月不相逢
    2021-02-20 07:14

    What about just

    print_r( str_word_count($_GET['q'],1) ); ?
    

    You can also explode( ' ', $string ) on the string and count( $array );

提交回复
热议问题