PHP 中的 substr_compare函数

首页 / PHP入门教程 / PHP 中的 substr_compare函数

substr_compare - 语法

substr_compare(string1,string2,startpos,length,case)

它用于比较特定起始位置的两个字符串格式

Sr.No 参数 & Description
1

string1

用于第一个字符串进行比较

2

string2

用于第二个字符串进行比较

链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-substr-compare.html

来源:LearnFk无涯教程网

3

startpos

它指定在string 1中开始字符串比较的位置

4

length

它指定字符串的长度

5

case

指定在何处执行区分大小写比较的布尔值

substr_compare - 返回值

它返回字符串函数

无涯教程网

substr_compare - 示例

<?php
   echo substr_compare("SAi RAM","RAM",6);
?>

这将产生以下输出-

-5

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

技术管理实战36讲 -〔刘建国〕

面试现场 -〔白海飞〕

ZooKeeper实战与源码剖析 -〔么敬国〕

软件设计之美 -〔郑晔〕

TensorFlow 2项目进阶实战 -〔彭靖田〕

Redis核心技术与实战 -〔蒋德钧〕

深度学习推荐系统实战 -〔王喆〕

HarmonyOS快速入门与实战 -〔QCon+案例研习社〕

大数据经典论文解读 -〔徐文浩〕

好记忆不如烂笔头。留下您的足迹吧 :)