当前位置:网站首页>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 .
边栏推荐
- Mongodb basic knowledge summary
- C# AES对字符串进行加密
- Drive development - the first helloddk
- [QNX hypervisor 2.2 user manual]6.3.3 using shared memory (shmem) virtual devices
- 02. Develop data storage of blog project
- Steady, 35K, byte business data analysis post
- Remember an error in MySQL: the user specified as a definer ('mysql.infoschema '@' localhost ') does not exist
- 指针经典笔试题
- Golang -- TCP implements concurrency (server and client)
- Summary of redis basic knowledge points
猜你喜欢

Please wait while Jenkins is getting ready to work

Vulhub vulnerability recurrence 73_ Webmin

自建DNS服务器,客户端打开网页慢,解决办法

JS array list actual use summary

Easy to understand I2C protocol
![[cloud native] 3.1 kubernetes platform installation kubespher](/img/86/137a65a5b58bc32e596d2a330ca9fc.png)
[cloud native] 3.1 kubernetes platform installation kubespher

Principle and performance analysis of lepton lossless compression

Rce code and Command Execution Vulnerability

Huawei equipment is configured with OSPF and BFD linkage

Safe mode on Windows
随机推荐
Solution of QT TCP packet sticking
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
指针经典笔试题
SQLite add index
[QNX hypervisor 2.2 user manual]6.3.3 using shared memory (shmem) virtual devices
2022 half year summary
C AES encrypts strings
用StopWatch 统计代码耗时
Modbus协议通信异常
Hyperledger Fabric2. Some basic concepts of X (1)
[cloud native] 3.1 kubernetes platform installation kubespher
Fiddler installed the certificate, or prompted that the certificate is invalid
Notes, continuation, escape and other symbols
ARTS Week 25
First acquaintance with CDN
【LeetCode】18、四数之和
Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
初识CDN
Summary of redis basic knowledge points
Vulhub vulnerability recurrence 69_ Tiki Wiki