mb_stripos

  • (PHP 5 >= 5.2.0, PHP 7)
  • mb_stripos — Finds position of first occurrence of a string within another, case insensitive
  • mb_stripos — 大小写不敏感地查找字符串在另一个字符串中首次出现的位置

Description

int mb_stripos (
string $haystack ,
string $needle [,
int $offset = 0 [,
string $encoding = mb_internal_encoding() ]]
)
//mb_stripos() returns the numeric position of the first occurrence of needle in the haystack string. Unlike mb_strpos(), mb_stripos() is case-insensitive. If needle is not found, it returns FALSE.
//mb_stripos() 返回 needle 在字符串 haystack 中首次出现位置的数值。 和 mb_strpos() 不同的是,mb_stripos() 是大小写不敏感的。 如果 needle 没找到,它将返回 FALSE。

Parameters

haystack

  • The string from which to get the position of the first occurrence of needle
  • 在这个字符串中查找获取 needle 首次出现的位置

needle

  • The string to find in haystack
  • 在 haystack 中查找这个字符串

offset

  • The position in haystack to start searching. A negative offset counts from the end of the string.
  • haystack 里开始搜索的位置。如果是负数,就从字符串的尾部开始统计。

encoding

  • Character encoding name to use. If it is omitted, internal character encoding is used.
  • 使用的字符编码名称。 如果省略了它,将使用内部字符编码。

Return Values

  • Return the numeric position of the first occurrence of needle in the haystack string, or FALSE if needle is not found.
  • 返回字符串 haystack 中 needle 首次出现位置的数值。 如果没有找到 needle,它将返回 FALSE。

Example

<?php
/**
* Created by PhpStorm.
* User: zhangrongxiang
* Date: 2018/2/3
* Time: 下午3:47
*/ $str = "PHP is the best language on the world!";
echo mb_stripos( $str, "php" ) . PHP_EOL; //0
echo mb_stripos( $str, "Best" ) . PHP_EOL; //11 // !== 严格比较
if ( mb_stripos( $str, "Php" ) !== false ) {
echo "exists" . PHP_EOL;
//php is the best language on the world!
echo mb_strtolower( $str ) . PHP_EOL;
} echo mb_stripos( $str, "THE", 10 ) . PHP_EOL;//28

文章参考

PHP之mb_stripos使用的更多相关文章

  1. php报错 Call to undefined function mb_stripos()

    错误原因 没有mbstring扩展 本文只介绍Linux解决办法 方法一 编译PHP的时候 带上--enable-mbstring参数 方法二 进入PHP源码/ext/mbstring目录 ./con ...

  2. php 基础代码大全(不断完善中)

    下面是基础的PHP的代码,不断完善中~ //语法错误(syntax error)在语法分析阶段,源代码并未被执行,故不会有任何输出. /* [命名规则] */ 常量名 类常量建议全大写,单词间用下划线 ...

  3. PHP7函数大全(4553个函数)

    转载来自: http://www.infocool.net/kb/PHP/201607/168683.html a 函数 说明 abs 绝对值 acos 反余弦 acosh 反双曲余弦 addcsla ...

  4. 两千行PHP学习笔记

    亲们,如约而至的PHP笔记来啦~绝对干货! 以下为我以前学PHP时做的笔记,时不时的也会添加一些基础知识点进去,有时还翻出来查查. MySQL笔记:一千行MySQL学习笔记http://www.cnb ...

  5. php错误以及常用笔记

    //语法错误(syntax error)在语法分析阶段,源代码并未被执行,故不会有任何输出. /* [命名规则] */ 常量名 类常量建议全大写,单词间用下划线分隔 // MIN_WIDTH 变量名建 ...

  6. php 学习笔记

    //本文转自:http://www.cnblogs.com/ronghua/p/6002995.html //语法错误(syntax error)在语法分析阶段,源代码并未被执行,故不会有任何输出. ...

  7. PHP编码相关函数试题

    1.检查字符串在指定的编码里是否有效的函数是什么? 2.获取字符编码的函数是什么? 3.解析 GET/POST/COOKIE 数据并设置全局变量的函数是什么? 4.大小写不敏感地查找字符串在另一个字符 ...

  8. PHP基础知识点

    //语法错误(syntax error)在语法分析阶段,源代码并未被执行,故不会有任何输出. /* [命名规则] */常量名 类常量建议全大写,单词间用下划线分隔 // MIN_WIDTH变量名建议用 ...

  9. 无格式转换php

    // 无格式转换function ClearHtml($content,$allowtags='') { mb_regex_encoding('UTF-8'); //replace MS specia ...

随机推荐

  1. Android-Sqlite-SQL操作增删改查

    一想到Android到数据库,只需要想到一个类 SQLiteOpenHelper,然后写一个类继承 SQLiteOpenHelper,重写构造方法,对数据库进行配置 public class MySQ ...

  2. MSP430 G2553 LaunchPad GPIO中断

    P1.P2端口上的每个管脚都支持外部中断.P1端口的所有管脚都对应同一个中断向量(Interrupt Vector),类似的,P2端口的所有管脚都对应另一个中断向量:通过PxIFG寄存器来判断中断来源 ...

  3. linux清理磁盘

    https://blog.csdn.net/u012660464/article/details/78923011 有时候,服务突然挂了,再次启动却启动不了.一看,原来是磁盘空间被占满啦,那么,怎么清 ...

  4. LeeDUT个人WEB作品

    *****目前大三前端狗一只,听说博客里写点记点能求OFFER***** 1.微云盘upan.oureda.cn  2013.10 微云盘是基于分布式系统.提供文件分享的校园存储站点,上传文件之后随即 ...

  5. linux下使用supervisor启动.net core mvc website的配置

    发布好的asp.net core mvc项目, 如果想在window或linux下的以控制台程序启动的话,可以用下面的命令 dotnet MyProject.dll --urls="http ...

  6. 一个CXF集成SPRING的WEBSERVICE完整实例

    1 首先准备以下JAR包 activation.jar commons-logging-1.1.1.jar cxf-2.5.6.jar jaxb-api-2.2.1.jar jaxb-impl-2.1 ...

  7. TestNG参数化之@Parameters传参

    通过TestNG实现参数话常用两种方式,一种是借助 @Parameters读取testng.xml中参数,一种是使用@DataProvider注解传参. 此次主要讲解XML传参,语法:在java类中定 ...

  8. C - Oil Deposits(dfs)

    点击打开链接 Oil Deposits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Othe ...

  9. CTF中密码学一些基础

    本文作者:i春秋签约作家MAX. 凯撒密码作为一种最为古老的对称加密体制,在古罗马的时候都已经很流行,他的基本思想是:通过把字母移动一定的位数来实现加密和解密. 给大家先找两道题,来一起探讨基础密码学 ...

  10. mxonline实战8,机构列表分页功能,以及按条件筛选功能

    对应github地址:列表分页和按条件筛选     一. 列表分页   1. pip install django-pure-pagination   2. settings.py中 install ...