Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2020
    Posts
    781

    What is the difference between the functions strstr() and stristr()?

    What is the difference between the functions strstr() and stristr()?

  2. #2
    Senior Member
    Join Date
    Aug 2021
    Location
    931 Clayton St San Francisco, CA 94117 United States
    Posts
    116
    strstr() and stristr both are used to find the first occurrence of the string.

    In PHP both functions are used to find the first occurrence of a substring in a string except
    stristr() is case-insensitive and strstr is case-sensitive, if no match is found then FALSE will be returned.

    Sample Usage:

    <?php
    $email = ‘abc@xyz.com’;
    $hostname = strstr($email, ‘@’);
    echo $hostname;
    output: @xyz.com
    ?>
    stristr() does the same thing in Case-insensitive manner.

Posting Permissions

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

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.