当前位置:网站首页>How to use PHP string query function
How to use PHP string query function
2022-07-06 05:30:00 【Yisu cloud】
php How to use string query function
This article “php How to use string query function ” Most people don't quite understand the knowledge points of the article , So I made up the following summary for you , Detailed content , The steps are clear , It has certain reference value , I hope you can gain something after reading this article , Let's take a look at this article “php How to use string query function ” Article bar .
php The string query function is :1、stripos() function , You can find the first occurrence position of the specified character ;2、strpos() function , You can find the first occurrence position of the specified character ;3、strripos() function , You can find the position of the last occurrence of the specified character ;4、strrpos() function .

The operating environment of this tutorial :windows7 System 、PHP7.1 edition 、DELL G3 The computer
php String query function in
1、stripos() function
stripos() Used to find the first occurrence position of a part of the string ( Case insensitive ).
<?php $findme = 'c'; $mystring1 = 'xyz'; $mystring2 = 'ABC'; $pos1 = stripos($mystring1, $findme); $pos2 = stripos($mystring2, $findme); var_dump($pos1); var_dump($pos2); ?>

2、strpos() function
strpos() Used to find the position where the string first appears ( Case sensitive ).
<?php $findme = 'c'; $findme1 = 'C'; $mystring = 'ABCabc'; $pos1 = strpos($mystring, $findme); $pos2 = strpos($mystring, $findme1); var_dump($pos1); var_dump($pos2); ?>

3、strripos() function
strripos() Used to calculate the position of the last occurrence of the specified string in the target string ( Case insensitive ).
<?php $findme = 'c'; $findme1 = 'C'; $mystring = 'ABCabcabcABC'; $pos1 = strripos($mystring, $findme); $pos2 = strripos($mystring, $findme1); var_dump($pos1); var_dump($pos2); ?>

4、strrpos() function
strrpos() Used to calculate the position of the last occurrence of the specified string in the target string
<?php $findme = 'c'; $findme1 = 'C'; $mystring = 'ABCabcabcABC'; $pos1 = strrpos($mystring, $findme); $pos2 = strrpos($mystring, $findme1); $pos3 = strrpos($mystring, $findme1,-5); var_dump($pos1); var_dump($pos2); var_dump($pos3); ?>

That's about “php How to use string query function ” The content of this article , I believe we all have a certain understanding , I hope the content shared by Xiaobian will be helpful to you , If you want to know more about it , Please pay attention to the Yisu cloud industry information channel .
边栏推荐
- 03. 开发博客项目之登录
- ByteDance program yuan teaches you how to brush algorithm questions: I'm not afraid of the interviewer tearing the code
- Remember an error in MySQL: the user specified as a definer ('mysql.infoschema '@' localhost ') does not exist
- 02. Develop data storage of blog project
- Check the useful photo lossless magnification software on Apple computer
- Note the various data set acquisition methods of jvxetable
- Modbus protocol communication exception
- 【华为机试真题详解】检查是否存在满足条件的数字组合
- Improve jpopup to realize dynamic control disable
- Ad20 is set with through-hole direct connection copper sheet, and the bonding pad is cross connected
猜你喜欢

指针经典笔试题

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

F12 solve the problem that web pages cannot be copied

【torch】|torch. nn. utils. clip_ grad_ norm_

Steady, 35K, byte business data analysis post

nacos-高可用seata之TC搭建(02)

Codeforces Round #804 (Div. 2) Editorial(A-B)

Modbus协议通信异常

Pointer classic written test questions

Vulhub vulnerability recurrence 68_ ThinkPHP
随机推荐
[detailed explanation of Huawei machine test] statistics of shooting competition results
浅谈镜头滤镜的类型及作用
MySQL time processing
Self built DNS server, the client opens the web page slowly, the solution
趋势前沿 | 达摩院语音 AI 最新技术大全
【torch】|torch. nn. utils. clip_ grad_ norm_
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
JS array list actual use summary
[machine learning notes] univariate linear regression principle, formula and code implementation
flutter 实现一个有加载动画的按钮(loadingButton)
F12 solve the problem that web pages cannot be copied
Mongodb basic knowledge summary
TCP three handshakes you need to know
【华为机试真题详解】检查是否存在满足条件的数字组合
Game push image / table /cv/nlp, multi-threaded start
ByteDance program yuan teaches you how to brush algorithm questions: I'm not afraid of the interviewer tearing the code
Game push: image / table /cv/nlp, multi-threaded start!
After the project is released, index Html is cached
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
[leetcode16] the sum of the nearest three numbers (double pointer)