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
What about just
print_r( str_word_count($_GET['q'],1) ); ?
You can also explode( ' ', $string ) on the string and count( $array );