SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    928
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    substr_count() is case-sensitive...

    Hi all,

    I am having a problem using substr_count to work as case-insensitive.. I have the following code:
    PHP Code:
    $num=substr_count($html'hello'); 
    It works perfectly when the file only contains hello but it cannot detect those HELLO, Hello.. etc.

    How can I make it such that it will match all cases?
    Any help will be greatly appreciated. Thank you.

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use strtolower() on the text

  3. #3
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    928
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher
    use strtolower() on the text
    Thanks for the suggestion


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •