zoukankan      html  css  js  c++  java
  • PHP字符串函数之 strpos stripos strrpos strripos

    • strpos – 查找字符串首次出现的位置
    • stripos – 查找字符串首次出现的位置(不区分大小写)
    • strrpos – 计算指定字符串在目标字符串中最后一次出现的位置
    • strripos – 计算指定字符串在目标字符串中最后一次出现的位置(不区分大小写)
    mixed strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )
    

    返回值

    成功:返回 needle 存在于 haystack 字符串起始的位置(独立于 offset) 
    失败:如果没找到 needle,将返回 FALSE。

    注意

    1. 字符串位置是从0开始,而不是从1开始的
    2. 此函数可能返回布尔值 FALSE,但也可能返回等同于 FALSE 的非布尔值 
      应使用 === 运算符或 !== 来测试此函数的返回值

    stripos

    查找字符串首次出现的位置(不区分大小写)

    mixed stripos ( string $haystack , string $needle [, int $offset = 0 ] )
    

      

    strrpos

    计算指定字符串在目标字符串中最后一次出现的位置

    mixed strrpos ( string $haystack , mixed $needle [, int $offset = 0 ] )

    注意

    1. 字符串位置是从0开始,而不是从1开始的
    2. 此函数可能返回布尔值 FALSE,但也可能返回等同于 FALSE 的非布尔值 
      应使用 === 运算符或 !== 来测试此函数的返回值

    strripos

    计算指定字符串在目标字符串中最后一次出现的位置(不区分大小写)

    mixed strripos ( string $haystack , mixed $needle [, int $offset = 0 ] )
    

      

  • 相关阅读:
    ZOJ-2008-Invitation Cards(dijkstra)
    codeforce-191E-Thwarting Demonstrations(树状数组+二分+离散)
    hdu-4612-Warm up(边双连通分量--有重边)
    TypeError: only integer scalar arrays can be converted to a scalar index
    电脑开机黑屏解决方法
    python中list与数组
    cv2.line()函数
    python中的浅拷贝与深拷贝——copy()
    pycharm中使用cv2模块
    numpy.where用法
  • 原文地址:https://www.cnblogs.com/echoshao/p/6513416.html
Copyright © 2011-2022 走看看