当前位置:网站首页>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 .
边栏推荐
- Modbus protocol communication exception
- Three. JS learning - light and shadow (understanding)
- Easy to understand IIC protocol explanation
- 注释、接续、转义等符号
- Summary of redis basic knowledge points
- 27io stream, byte output stream, OutputStream writes data to file
- MySQL if and ifnull use
- In 2022, we must enter the big factory as soon as possible
- Talking about the type and function of lens filter
- Pix2pix: image to image conversion using conditional countermeasure networks
猜你喜欢
Codeforces Round #804 (Div. 2) Editorial(A-B)
SQLite add index
04. Project blog log
[cloud native] 3.1 kubernetes platform installation kubespher
Sword finger offer II 039 Maximum rectangular area of histogram
Modbus协议通信异常
Easy to understand I2C protocol
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
Implementing fuzzy query with dataframe
Pointer classic written test questions
随机推荐
jdbc使用call调用存储过程报错
[QNX hypervisor 2.2 user manual]6.3.3 using shared memory (shmem) virtual devices
01. Project introduction of blog development project
Golang -- TCP implements concurrency (server and client)
无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
[QNX Hypervisor 2.2用户手册]6.3.3 使用共享内存(shmem)虚拟设备
指针经典笔试题
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
Deep learning -yolov5 introduction to actual combat click data set training
Vulhub vulnerability recurrence 71_ Unomi
Pix2pix: image to image conversion using conditional countermeasure networks
Notes, continuation, escape and other symbols
Steady, 35K, byte business data analysis post
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
03. 开发博客项目之登录
算法-- 爬楼梯(Kotlin)
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
01. 开发博客项目之项目介绍
Vulhub vulnerability recurrence 72_ uWSGI
Text classification still stays at Bert? The dual contrast learning framework is too strong