Questions tagged [substr-count]
4 questions
0
votes
1 answer
Using substr_count to count multiple words in an array
I trying to solve a bug in my code, i need to get the number of times words appear in a string. It's working fine with single words but i need it to only count the exact sentence (which may contain spaces)
$name = 'apple';
$words = array("apple",…

Mystic
- 147
- 1
- 14
0
votes
1 answer
Count how many times something was echoed in a range?
I'm just a little stumped, I have a simple range of 1-20 listed out, and displays as follows, showing multiples of 3 within a range, and multiples of 5 within a range. These were displayed with echoes, is there a possible way that I can just count…

Mixmastermiike
- 449
- 1
- 5
- 16
0
votes
1 answer
Why isn't str_count working with multiple strings?
I have a string with text like this:
Text <- c("How are you","What is your name","Hi my name is","You ate your cake")
And I want an output that counts the number of times the word "you" or "your" appears
Text NumYou
"How are you" …

Claire Wilson
- 7
- 3
0
votes
1 answer
PHP count word frequency with support for punctuation marks
I am trying to get a count of common phrases from a body of text. I don't just want single words, but rather all series of words between any stop words. So for example, https://en.wikipedia.org/wiki/Wuthering_Heights I would like the phrase…

Dan Hastings
- 3,241
- 7
- 34
- 71