Home  >  Article  >  Backend Development  >  Is php strstr() case insensitive?

Is php strstr() case insensitive?

青灯夜游
青灯夜游Original
2021-09-26 19:11:192264browse

No, php strstr() is case-sensitive. strstr() is used to perform string search in a case-sensitive manner, searching whether the specified string exists in another string; if it exists, the string and the remaining part are returned, otherwise FALSE is returned.

Is php strstr() case insensitive?

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

strstr() function searches for a string in another Whether it exists in the string, if so, return the string and the remaining part, otherwise return FALSE.

strstr() function is case-sensitive. To perform a case-insensitive search, use the stristr() function.

Syntax:

strstr(string,search,before_search)
Parameters Description
string Required. Specifies the string to be searched for.
search Required. Specifies the string to search for. If the argument is a number, searches for characters that match the ASCII value for that number.
before_search Optional. A Boolean value with a default value of "false". If set to "true", it will return the portion of the string preceding the first occurrence of the search parameter.

Return value: Returns the remaining part of the string (from the matching point). Returns FALSE if the searched string is not found.

Example:

<?php
echo strstr("Hello world!","llo");
?>

Output

Is php strstr() case insensitive?

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Is php strstr() case insensitive?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn