PHP strrchr() 函数

PHP 教程 · 2019-01-30 10:58:03

实例

搜索 "world" 在字符串中的位置,并返回从该位置到字符串结尾的所有字符:

<?php
echo strrchr("Hello world!","world");
?>

定义和用法

strrchr() 函数查找字符串在另一个字符串中最后一次出现的位置,并返回从该位置到字符串结尾的所有字符。

注释:该函数是二进制安全的。

语法


strrchr(string,char)


参数 描述
string 必需。规定被搜索的字符串。
char 必需。规定要查找的字符。如果该参数是数字,则搜索匹配数字 ASCII 值的字符。

技术细节

返回值: 返回从某个字符串在另一个字符串中最后一次出现的位置到主字符串结尾的所有字符。如果没有找到字符,则返回 FALSE。
PHP 版本: 4+
更新日志: 在 PHP 4.3 中,该函数变成是二进制安全的。

更多实例

实例 1

搜索 "" 在字符串中的位置,并返回从该位置到字符串结尾的所有字符:

<?php
echo strrchr("Hello world! What a beautiful day!",What);
?>

实例 2

通过 "o" 的 ASCII 值搜索 "o" 在字符串中的位置,并返回从该位置到字符串结尾的所有字符:

<?php
echo strrchr("Hello world!",111);
?>

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

查看所有标签

Pro Git (Second Edition)

Pro Git (Second Edition)

Scott Chacon、Ben Straub / Apress / 2014-11-9 / USD 59.99

Scott Chacon is a cofounder and the CIO of GitHub and is also the maintainer of the Git homepage ( git-scm.com ) . Scott has presented at dozens of conferences around the world on Git, GitHub and the ......一起来看看 《Pro Git (Second Edition)》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

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

Markdown 在线编辑器