PHP strripos() 函数

PHP 教程 · 2019-01-30 11:29:09

实例

查找 "php" 在字符串中最后一次出现的位置:

<?php
echo strripos("I love php, I love php too!","PHP");
?>

定义和用法

strripos() 函数查找字符串在另一字符串中最后一次出现的位置(不区分大小写)。

注释:strripos() 函数是不区分大小写的。

相关函数:

  • stripos() - 查找字符串在另一字符串中第一次出现的位置(不区分大小写)
  • strpos() - 查找字符串在另一字符串中第一次出现的位置(区分大小写)
  • strrpos() - 查找字符串在另一字符串中最后一次出现的位置(区分大小写)

语法


strripos(string,find,start)


参数 描述
string 必需。规定被搜索的字符串。
find 必需。规定要查找的字符。
start 可选。规定开始搜索的位置。

技术细节

返回值: 返回字符串在另一字符串中最后一次出现的位置,如果没有找到字符串则返回 FALSE。注释: 字符串位置从 0 开始,不是从 1 开始。
PHP 版本: 5+
更新日志: 自 PHP 5.0 起,find 参数可以是一个超过一个字符的字符串。

在 PHP 5.0 中,新增了 start 参数。

点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Data Structures and Algorithms

Data Structures and Algorithms

Alfred V. Aho、Jeffrey D. Ullman、John E. Hopcroft / Addison Wesley / 1983-1-11 / USD 74.20

The authors' treatment of data structures in Data Structures and Algorithms is unified by an informal notion of "abstract data types," allowing readers to compare different implementations of the same......一起来看看 《Data Structures and Algorithms》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具