Home>Article>Backend Development> What is the usage of strstr function in php

What is the usage of strstr function in php

王林
王林 Original
2021-07-06 15:25:59 2182browse

The usage of strstr function in php is to search whether a string exists in another string, such as [strstr("Hello world!",111);]. If present, the function returns the string and the remainder.

What is the usage of strstr function in php

The operating environment of this article: windows10 system, php 7.3, thinkpad t480 computer.

strstr() function searches whether a string exists in another string. If so, returns the string and the remaining part, otherwise returns FALSE.

For example, search the string through the ASCII value of "o" and return the remaining part of the string

     

Running result:

o world!

For example, we want to return " world" The string part before the first appearance

     

Running results:

Hello

Related video tutorial sharing:php video tutorial

The above is the detailed content of What is the usage of strstr function in php. 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