无涯教程-PHP - substr_compare函数

56 阅读1分钟

substr_compare - 语法

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

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

Sr.No 参数 & Description
1

string1

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

2

string2

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

3

startpos

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

4

length

它指定字符串的长度

5

case

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

substr_compare - 返回值

它返回字符串函数

substr_compare - 示例

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

这将产生以下输出-

-5

参考链接

www.learnfk.com/php/php-fun…