当前位置:网站首页>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 .
边栏推荐
- 01. Project introduction of blog development project
- Select knowledge points of structure
- 指針經典筆試題
- Promotion hung up! The leader said it wasn't my poor skills
- JDBC calls the stored procedure with call and reports an error
- 01. 开发博客项目之项目介绍
- Configuration file converted from Excel to Lua
- JS quick start (II)
- Steady, 35K, byte business data analysis post
- C Advanced - data storage (Part 1)
猜你喜欢

February 12 relativelayout

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

Using stopwatch to count code time

Codeless June event 2022 codeless Explorer conference will be held soon; AI enhanced codeless tool launched

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】18、四数之和

How to download GB files from Google cloud hard disk

Remember an error in MySQL: the user specified as a definer ('mysql.infoschema '@' localhost ') does not exist

Sword finger offer II 039 Maximum rectangular area of histogram

图数据库ONgDB Release v-1.0.3
随机推荐
flutter 实现一个有加载动画的按钮(loadingButton)
js Array 列表 实战使用总结
【torch】|torch.nn.utils.clip_grad_norm_
Modbus protocol communication exception
Self built DNS server, the client opens the web page slowly, the solution
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
UCF(2022暑期团队赛一)
nacos-高可用seata之TC搭建(02)
[QNX hypervisor 2.2 user manual]6.3.3 using shared memory (shmem) virtual devices
Vulhub vulnerability recurrence 71_ Unomi
Compilation et connexion de shader dans games202 - webgl (comprendre la direction)
C进阶-数据的存储(上)
[QNX Hypervisor 2.2用户手册]6.3.3 使用共享内存(shmem)虚拟设备
Jvxetable implant j-popup with slot
Note the various data set acquisition methods of jvxetable
Qt TCP 分包粘包的解决方法
Nacos TC setup of highly available Seata (02)
05. Security of blog project
Huawei od computer test question 2
剑指 Offer II 039. 直方图最大矩形面积