How to use php stripos function

藏色散人
Release: 2023-04-05 06:44:02
Original
2490 people have browsed it

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)
Copy after login

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")
?>
Copy after login

Output:

9
Copy after login

php stripos() function usage example 2:

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

Output:

0
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!