<?php


$haystack = 'helloe';
$needle   = 'e';

$pos      = stripos($haystack, $needle);

echo "\n";

echo $pos;die;  // 加r的是5 ,不加r的是 1,索引值从0开始,所以判断时 要 false !== $pos 来判断

/*

stripos

(PHP 5)
stripos — Find the position of the first occurrence of a case-insensitive substring in a string

strpos

(PHP 4, PHP 5)
strpos — Find the position of the first occurrence of a substring in a string

查看一个字符在字符串中首次出现的位置,i 表示忽略大小写

strripos

(PHP 5)
strripos — Find the position of the last occurrence of a case-insensitive substring in a string


strrpos

(PHP 4, PHP 5)
strrpos — Find the position of the last occurrence of a substring in a string

查看一个字符在字符串中最后一次出现的位置,i 表示忽略大小写

*/

  

相关文章:

  • 2022-12-23
  • 2021-06-18
  • 2021-12-21
  • 2022-02-09
  • 2022-12-23
  • 2023-04-10
  • 2022-02-07
  • 2021-08-29
猜你喜欢
  • 2022-01-10
  • 2021-06-26
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2021-09-06
相关资源
相似解决方案