Is php strstr() case insensitive?

青灯夜游
Release: 2023-03-13 06:34:01
Original
2283 people have browsed it

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)
Copy after login
ParametersDescription
stringRequired. Specifies the string to be searched for.
searchRequired. 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");
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template