In PHP, you can use the stristr() function to find another substring in a string without case sensitivity. Returns the remainder of the string (from the matching point) if the lookup is successful, or false if the string is not found.
In PHP, the stristr() function is used to find another string in a string without case sensitivity. [Related recommendations: PHP Tutorial]
If the search is successful, the rest of the string (from the matching point) is returned. If the string is not found, false is returned.
Syntax
stristr(string,search,before_search)
Example: Return the part of the string before the first occurrence of "world" :
<!DOCTYPE html> <html> <body> <?php echo stristr("Hello world!","WORLD",true); ?> </body> </html>
Result:
Hello
Related learning recommendations: PHP programming from entry to proficiency
The above is the detailed content of How to find substrings in PHP strings without case sensitivity?. For more information, please follow other related articles on the PHP Chinese website!