当前位置:网站首页>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 .
边栏推荐
- MySQL time processing
- 初识CDN
- Cuda11.1 online installation
- Codeforces Round #804 (Div. 2) Editorial(A-B)
- Vulhub vulnerability recurrence 72_ uWSGI
- Self built DNS server, the client opens the web page slowly, the solution
- [mask requirements of OSPF and Isis in multi access network]
- HAC集群修改管理员用户密码
- Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
- Implementing fuzzy query with dataframe
猜你喜欢

Hyperledger Fabric2. Some basic concepts of X (1)

Easy to understand I2C protocol

Vulhub vulnerability recurrence 67_ Supervisor

February 12 relativelayout
![[cloud native] 3.1 kubernetes platform installation kubespher](/img/86/137a65a5b58bc32e596d2a330ca9fc.png)
[cloud native] 3.1 kubernetes platform installation kubespher

Modbus protocol communication exception

Figure database ongdb release v-1.0.3

【OSPF 和 ISIS 在多路访问网络中对掩码的要求】

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

Codeforces Round #804 (Div. 2) Editorial(A-B)
随机推荐
C AES encrypts strings
趋势前沿 | 达摩院语音 AI 最新技术大全
Huawei equipment is configured with OSPF and BFD linkage
Game push: image / table /cv/nlp, multi-threaded start!
Zoom and pan image in Photoshop 2022
Vulhub vulnerability recurrence 71_ Unomi
Using stopwatch to count code time
Codeforces Round #804 (Div. 2) Editorial(A-B)
nacos-高可用seata之TC搭建(02)
MySQL advanced learning summary 9: create index, delete index, descending index, and hide index
UCF(暑期团队赛二)
Mysql高级篇学习总结9:创建索引、删除索引、降序索引、隐藏索引
Select knowledge points of structure
[machine learning notes] univariate linear regression principle, formula and code implementation
Vulhub vulnerability recurrence 68_ ThinkPHP
【云原生】3.1 Kubernetes平台安装KubeSpher
Principle and performance analysis of lepton lossless compression
UCF (2022 summer team competition I)
指針經典筆試題
February 12 relativelayout