当前位置:网站首页>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 .
边栏推荐
- Jvxetable用slot植入j-popup
- Pix2pix: image to image conversion using conditional countermeasure networks
- Select knowledge points of structure
- 无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
- 毕业设计游戏商城
- 27io stream, byte output stream, OutputStream writes data to file
- Safe mode on Windows
- Steady, 35K, byte business data analysis post
- Qt TCP 分包粘包的解决方法
- Huawei equipment is configured with OSPF and BFD linkage
猜你喜欢

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

Steady, 35K, byte business data analysis post

初识CDN

04. Project blog log

Please wait while Jenkins is getting ready to work

Simple understanding of interpreters and compilers

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

05. Security of blog project

C进阶-数据的存储(上)

nacos-高可用seata之TC搭建(02)
随机推荐
Using stopwatch to count code time
Modbus协议通信异常
ByteDance program yuan teaches you how to brush algorithm questions: I'm not afraid of the interviewer tearing the code
Steady, 35K, byte business data analysis post
[leetcode16] the sum of the nearest three numbers (double pointer)
MySQL if and ifnull use
毕业设计游戏商城
TCP three handshakes you need to know
Driver development - hellowdm driver
Yyds dry inventory SSH Remote Connection introduction
Set detailed map + interview questions
【torch】|torch. nn. utils. clip_ grad_ norm_
C Advanced - data storage (Part 1)
02. Develop data storage of blog project
Improve jpopup to realize dynamic control disable
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
02. 开发博客项目之数据存储
First acquaintance with CDN
Summary of deep learning tuning tricks
【华为机试真题详解】检查是否存在满足条件的数字组合