位置: 编程技术 - 正文

PHP:mb_ereg_replace_callback()的用法_mbstring函数

编辑:rootadmin
mb_ereg_replace_callback

推荐整理分享PHP:mb_ereg_replace_callback()的用法_mbstring函数,希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 5 >= 5.4.1)

mb_ereg_replace_callback — Perform a regular expresssion seach and replace with multibyte support using a callback

说明 string mb_ereg_replace_callback ( string $pattern , callable $callback , string $string [, string $option = "msr" ] )

Scans string for matches to pattern, then replaces the matched text with the output of callback function.

The behavior of this function is almost identical to mb_ereg_replace(), except for the fact that instead of replacement parameter, one should specify a callback.

参数

pattern

The regular expression pattern.

Multibyte characters may be used in pattern.

callback

A callback that will be called and passed an array of matched elements in the subject string. The callback should return the replacement string.

You&#;ll often need the callback function for a mb_ereg_replace_callback() in just one place. In this case you can use an anonymous function to declare the callback within the call to mb_ereg_replace_callback(). By doing it this way you have all information for the call in one place and do not clutter the function namespace with a callback function&#;s name not used anywhere else.

string PHP:mb_ereg_replace_callback()的用法_mbstring函数

The string being checked.

option

Matching condition can be set by option parameter. If i is specified for this parameter, the case will be ignored. If x is specified, white space will be ignored. If m is specified, match will be executed in multiline mode and line break will be included in &#;.&#;. If p is specified, match will be executed in POSIX mode, line break will be considered as normal character. Note that e cannot be used for mb_ereg_replace_callback().

返回值

The resultant string on success, or FALSE on error.

注释

Note:

mb_regex_encoding()指定的内部编码或字符编码将会当作此函数用的字符编码。

范例

Example #1 mb_ereg_replace_callback() example

<?php//thistextwasusedin//wewanttogetthisuptodatefor$text="Aprilfoolsdayis//n";$text.="Lastchristmaswas//n";//thecallbackfunctionfunctionnext_year($matches){//asusual:$matches[0]isthecompletematch//$matches[1]thematchforthefirstsubpattern//enclosedin'(...)'andsoonreturn$matches[1].($matches[2]+1);}echomb_ereg_replace_callback("(d{2}/d{2}/)(d{4})","next_year",$text);?>

以上例程会输出:

Example #2 mb_ereg_replace_callback() using anonymous function supported in PHP 5.3.0 or later

<?php//thistextwasusedin//wewanttogetthisuptodatefor$text="Aprilfoolsdayis//n";$text.="Lastchristmaswas//n";echomb_ereg_replace_callback("(d{2}/d{2}/)(d{4})",function($matches){return$matches[1].($matches[2]+1);},$text);?>

参见

mb_regex_encoding() - Set/Get character encoding for multibyte regex mb_ereg_replace() - Replace regular expression with multibyte support Anonymous functions callback 类型的信息

PHP:mb_ereg_search_getregs()的用法_mbstring函数 mb_ereg_search_getregs(PHP4=4.2.0,PHP5)mb_ereg_search_getregsRetrievetheresultfromthelastmultibyteregularexpressionmatch说明arraymb_ereg_search_getregs(void)Retrievetheresultfromthelastmultibyteregu

PHP:mb_ereg_search_getpos()的用法_mbstring函数 mb_ereg_search_getpos(PHP4=4.2.0,PHP5)mb_ereg_search_getposReturnsstartpointfornextregularexpressionmatch说明intmb_ereg_search_getpos(void)Returnsthestartpointforthenextregularexpressionmatch.参数

PHP:mb_encode_numericentity()的用法_mbstring函数 mb_encode_numericentity(PHP4=4.0.6,PHP5)mb_encode_numericentityEncodecharactertoHTMLnumericstringreference说明stringmb_encode_numericentity(string$str,array$convmap[,string$encoding=mb_internal_enco

标签: PHP:mb_ereg_replace_callback()的用法_mbstring函数

本文链接地址:https://www.jiuchutong.com/biancheng/275028.html 转载请保留说明!

上一篇:PHP:mb_ereg_replace()的用法_mbstring函数

下一篇:PHP:mb_ereg_search_getregs()的用法_mbstring函数

  • 年度纳税申报表A105000纳税调整项目明细表中,收入
  • 中国注册税务师报考条件
  • 建筑行业小规模纳税人免税政策
  • 政府减免税款如何账务处理
  • 个体户电子发票怎么作废
  • 个体工商户网上报税流程
  • 纳税人申请退税需要报送的资料和证件有
  • 企业增加注册资金怎么办理
  • 企业清算未分配利润不分配要交个税吗
  • 开具简易计税房租发票怎样填写增值税申报表
  • 营业外支出税前可以扣除吗
  • 经济法基础企业所得税好难
  • 子公司具有独立的法律地位吗
  • 单位为员工报销的博士学费算什么费用
  • 差额征税的差额怎么算
  • 推广费什么公司能开
  • 双倍余额法折旧率计算公式
  • 应收账款贷方余额重分类到哪
  • win11正式版好用吗
  • 金融负债包括哪几项
  • 分期购车的会计分录
  • scanexplicit.exe - scanexplicit是什么进程 作用是什么
  • 已抵扣的发票怎么撤销
  • 浏览器显示英语怎么设置成中文
  • wordpress常用api
  • 公寓收费标准
  • sudo命令无法执行
  • 取得普通发票与专票区别
  • 木鱼的电脑
  • 专项储备购买安全设备会计分录
  • 城市赚钱项目
  • 非营利组织免税范围
  • 卢塞恩小镇瑞士
  • vue3刷新组件
  • 预收账款和应收账款的账务处理
  • ci框架如何做api
  • 管理费用科目核算的内容
  • 电子税务局里的自然人是什么意思
  • 物流公司开几个点的发票
  • 公交卡充值发票报销单怎么填
  • 残疾人就业保障金减免政策2023
  • php框架是干什么的
  • python中如何创建字典
  • 增值税零税率和免税的范围
  • 各种账簿的登记依据和登记方法分别是什么
  • 销售金银首饰增值税和企业所得税
  • 进口卷烟消费税定额税率
  • 公共电话亭设计案例
  • 以旧换新价格怎么确认
  • 加油费不征税发票怎么开
  • 劳务派遣员工工会福利谁发放
  • 应收账款记账凭证怎么写
  • 小规模一季度不超过30万是不含税吗
  • 银行涉外收入申报单
  • 经营性应收项目和经营性应付项目
  • 账簿按形式分几种
  • mysql批量删除数据库死锁
  • linux详解
  • centos7如何修改用户名
  • ubuntu怎样
  • win xp怎么样
  • window mobile系统
  • 2016年首个国家安全教育日
  • cocos2d原理
  • cocos 2dx
  • javascript entries
  • linux启动过程流程图
  • flask开发实例
  • unity移动游戏开发
  • a标签跳转本地html页面
  • asp.net+jquery.form实现图片异步上传的方法(附jquery.form.js下载)
  • jQuery插件封装时如要实现链式编程,需要
  • 山东契税补贴政策2023年
  • 个人所得税app什么时候能查到月收入
  • 是否一般纳税人怎么查
  • 专票最高几个点
  • 退契税可以不用本人银行卡吗
  • 广东省通用机打发票怎么开
  • 江西社保申报时间
  • 地税注销需要什么资料
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设