Welcome Guest, Not a member yet? Register   Sign In
Count words in Div
#3

[eluser]PhilTem[/eluser]
Hm... I'd suggest using

Code:
preg_match_all($pattern, $div_string, $matches);

with the correct pattern that also matches some attributes like 'class' or 'id' within '<div>' if you have these (I'm not good at regexp-patterns, better ask somebody else Wink ) and then use

Code:
count($matches);

to count the amount of matched items i.e. words.

But what exactly is your definition for 'word'? Is it a random string pattern surrounded by white-spaces? Or must it be a word that can be found within a dictionary? So to speak: 'Real words' or only 'character combinations surrounded by white-spaces'? What's your use case?


Messages In This Thread
Count words in Div - by El Forum - 01-19-2012, 04:39 AM
Count words in Div - by El Forum - 01-19-2012, 05:20 AM
Count words in Div - by El Forum - 01-19-2012, 06:46 AM
Count words in Div - by El Forum - 01-19-2012, 07:46 AM
Count words in Div - by El Forum - 01-19-2012, 09:28 AM
Count words in Div - by El Forum - 01-19-2012, 03:16 PM
Count words in Div - by El Forum - 01-23-2012, 08:11 AM
Count words in Div - by El Forum - 01-23-2012, 08:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB