Home  >  Article  >  Backend Development  >  How to use php stripos function

How to use php stripos function

藏色散人
藏色散人Original
2019-02-11 10:05:332451browse

PHP stripos is used to find the first occurrence of a string (not case-sensitive). Its syntax is stripos(string,find,start). The parameter string is required and specifies the string to be searched; find is required and specifies the search string. character of.

How to use php stripos function

#How to use php stripos function?

php stripos() function syntax

Function: Find the first occurrence of a character in a string, case-insensitive

Syntax:

stripos(string,find,start)

Parameters:

string required. Specifies the string to search for.

findRequired. Specifies the characters to search for.

start is optional. Specifies the location from which to start the search.

Description:

Find the first occurrence of a string in another string (case-insensitive). The stripos() function is case-insensitive. This function is binary safe.

php stripos() function usage example 1:

<?php
echo stripos("You love php, I love php too!","PHP")
?>

Output:

9

php stripos() function usage example 2:

<?php
echo stripos("PHP is a good development language!","php");
?>

Output:

0

This article is an introduction to the PHP stripos function. I hope it will be helpful to friends in need!

The above is the detailed content of How to use php stripos function. 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