前言
本文主要介绍了关于php之mb_strstr基本使用的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧。
mb_strstr
description
string mb_strstr ( string $haystack , string $needle [, bool $before_needle = false [, string $encoding =mb_internal_encoding() ]] ) //mb_strstr() finds the first occurrence of needle in haystack and returns the portion of haystack. if needle is not found, it returns false. //mb_strstr() 查找了 needle 在 haystack 中首次的出现并返回 haystack 的一部分。 如果 needle 没有找到,它将返回 false。
parameters
haystack
needle
before_needle
encoding
return values
examples
<?php /** * created by phpstorm. * user: zhangrongxiang * date: 2018/2/1 * time: 下午10:27 */ //* * if set to true, it returns all of haystack from the beginning to the first occurrence of needle. $strstr = mb_strstr( "hello china", "ll", true ); echo $strstr . php_eol; //he //* if set to false, it returns all of haystack from the first occurrence of needle to the end, $strstr = mb_strstr( "hello china", "ll", false ); echo $strstr . php_eol;//llo china //hello china echo mb_strstr( "hello china", "ll", true ) . mb_strstr( "hello china", "ll", false ) . php_eol; $strstr = mb_strstr( "hello china,hello php", "ll", true ); echo $strstr . php_eol; //he $strstr = mb_strstr( "hello china,hello php", "ll", false ); echo $strstr . php_eol; //llo china,hello php $strstr = mb_strstr( "php是世界上最好的语言😄", "最好", true ); echo $strstr.php_eol; //php是世界上 $strstr = mb_strstr( "php是世界上最好的语言😄", "最好", false ); echo $strstr.php_eol; //最好的语言😄
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对移动技术网的支持。
如对本文有疑问, 点击进行留言回复!!
thinkphp5 + ajax 使用formdata提交数据(包括文件上传) 后台返回json完整实例
使用Entrust扩展包在laravel 中实现RBAC的功能
网友评论