当前位置:网站首页>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 .
边栏推荐
- 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
- [leetcode daily question] number of enclaves
- 【华为机试真题详解】统计射击比赛成绩
- Three. JS learning - light and shadow (understanding)
- Modbus protocol communication exception
- Review of double pointer problems
- Pix2pix: image to image conversion using conditional countermeasure networks
- After the project is released, index Html is cached
- 02. Develop data storage of blog project
- Detailed summary of SQL injection
猜你喜欢
Graduation design game mall
浅谈镜头滤镜的类型及作用
Codeforces Round #804 (Div. 2) Editorial(A-B)
自建DNS服务器,客户端打开网页慢,解决办法
Pointer classic written test questions
05. 博客项目之安全
03. Login of development blog project
Vite configures the development environment and production environment
02. 开发博客项目之数据存储
Compilation et connexion de shader dans games202 - webgl (comprendre la direction)
随机推荐
Vite configures the development environment and production environment
Solution of QT TCP packet sticking
无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
Problems encountered in installing mysql8 on MAC
Knowledge points of circular structure
Using stopwatch to count code time
Promise summary
趋势前沿 | 达摩院语音 AI 最新技术大全
[mask requirements of OSPF and Isis in multi access network]
用StopWatch 统计代码耗时
[leetcode daily question] number of enclaves
Steady, 35K, byte business data analysis post
【华为机试真题详解】统计射击比赛成绩
03. 开发博客项目之登录
Notes, continuation, escape and other symbols
flutter 实现一个有加载动画的按钮(loadingButton)
Fiddler installed the certificate, or prompted that the certificate is invalid
Hyperledger Fabric2. Some basic concepts of X (1)
注释、接续、转义等符号
【torch】|torch.nn.utils.clip_grad_norm_