Jump to content


Photo

I need help


  • Please log in to reply
2 replies to this topic

#1 Uncannytable

Uncannytable
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 08 July 2006 - 03:50 PM

What is the command for counting the number of times a letter appears on a string?

#2 Kurt

Kurt
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts
  • LocationNew York

Posted 08 July 2006 - 04:00 PM

Use substr_count($string,"Text to search for"). Example:

$count=substr_count('Phpfreaks rocks!','p');
echo $count;//outputs 2


#3 Uncannytable

Uncannytable
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 July 2006 - 12:50 PM

Thanks.
it helped a lot.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users