PHP Ereg与Preg [英] PHP ereg vs. preg

查看:79
本文介绍了PHP Ereg与Preg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在PHP regex库中,可以在ereg和preg之间进行选择.有什么区别?一个比另一个快吗?如果是,为什么不推荐较慢的一个呢?

I have noticed in the PHP regex library there is a choice between ereg and preg. What is the difference? Is one faster than the other and if so, why isn't the slower one deprecated?

在任何情况下都最好使用一种方法吗?

Are there any situations where it is better to use one over the other?

推荐答案

访问php.net/ereg显示以下内容:

Visiting php.net/ereg displays the following:

警告

此功能从PHP 5.3.0开始已被弃用,从PHP 6.0.0开始已被删除.强烈建议不要使用此功能.

This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

再往下走一点,我们读到以下内容:

Down the page just a bit further and we read this:

注意:preg_match()使用与Perl兼容的正则表达式语法,通常是ereg()的更快替代方法.

请注意我的强调.

这篇关于PHP Ereg与Preg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆