当前位置:网站首页>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 .
边栏推荐
- Vulhub vulnerability recurrence 67_ Supervisor
- Knowledge points of circular structure
- Fluent implements a loadingbutton with loading animation
- 02. Develop data storage of blog project
- 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
- 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
- JDBC calls the stored procedure with call and reports an error
- Implementing fuzzy query with dataframe
- Golang -- TCP implements concurrency (server and client)
- Mongodb basic knowledge summary
猜你喜欢
剑指 Offer II 039. 直方图最大矩形面积
CUDA11.1在线安装
Compilation and connection of shader in games202 webgl (learn from)
29io stream, byte output stream continue write line feed
Three methods of Oracle two table Association update
Review of double pointer problems
Cuda11.1 online installation
Easy to understand I2C protocol
nacos-高可用seata之TC搭建(02)
Promise summary
随机推荐
MySQL time processing
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
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
Compilation and connection of shader in games202 webgl (learn from)
UCF(2022暑期团队赛一)
Ad20 is set with through-hole direct connection copper sheet, and the bonding pad is cross connected
UCF (2022 summer team competition I)
注释、接续、转义等符号
Tetris
Rce code and Command Execution Vulnerability
Summary of redis basic knowledge points
Force buckle 1189 Maximum number of "balloons"
Yyds dry inventory SSH Remote Connection introduction
2022 half year summary
Easy to understand I2C protocol
Pointer classic written test questions
Selective parameters in MATLAB functions
[QNX Hypervisor 2.2用户手册]6.3.3 使用共享内存(shmem)虚拟设备
Set detailed map + interview questions
JDBC calls the stored procedure with call and reports an error