Jump to content


***SOLVED*** Count the instances of a string within a string

  • Please log in to reply
No replies to this topic

#1 wisewood

  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 14 June 2006 - 12:47 PM

I have a string, which for example, might be this;

$string = "The quick brown fox jumped over the lazy dog";

I want a way to count, for example, how many times the letter "o" appears in that string.

Can someone nidge me in the right direction... my brain isnt working today.


Engaged my brain and used the substr_count() function.
wisewood: proven fact, I am both wise, and wooden.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users