phps mb_ereg 函数可以安全使用吗(由于 ereg 已被弃用)?

发布于 2024-10-02 11:57:11 字数 204 浏览 3 评论 0原文

我只是想调整我的代码以兼容 php 5.3 (6.0)。 所以我想将对 ereg 函数的所有调用替换为相应的 preg 函数。

但后来我发现 mb_ereg 函数尚未被标记为已弃用。所以我只是想知道依靠他们是否可以节省?是否知道它们也将很快被宣布弃用,或者甚至是文档中的缺陷?

I just wanted to adapt my code to be compatible to php 5.3 (6.0).
So i wanted to replace all the calls to the ereg functions with the corresponding preg functions.

But then I saw that the mb_ereg function haven't been marked as deprecated. So I am just wondering if it is save to rely on them? Is something known that they will also been declared deprecated soon or is it even a flaw in the documentation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

昨迟人 2024-10-09 11:57:11

我不会依赖他们。 preg 函数更快、更高效、更强大并且简单地支持 UTF8。我建议使用 preg 函数来满足您的所有正则表达式需求。

但要直接回答您的问题,似乎 mb_ereg 并未被弃用......

I wouldn't depend on them. The preg functions are faster, more efficient, much more powerful and naively support UTF8. I would recommend using the preg functions for all of your regex needs.

But to directly answer your question, it does not appear that mb_ereg is deprecated...

终陌 2024-10-09 11:57:11

如果您想快速解决问题并节省时间,可以将所有 ereg 替换为 mb_eregmb_ereg 未标记为已弃用,它是 ereg 的直接替代品。

你可以依赖它一段时间或更长时间,我们不知道。但如果您有一些空闲时间,我认为应该更好,正如 ircmaxell 建议的那样,将所有 mb_ereg 替换为 preg

You can replace all of your ereg with mb_ereg if you want quick solution and save your time. mb_ereg is not marked as deprecated and it is a direct replacement for ereg.

You can rely on it for certain time or longer, we don't know. But if you have some free time, I think should be better, as ircmaxell suggest, to replace all of your mb_ereg with preg.

飘然心甜 2024-10-09 11:57:11

mb_ereg 并未被弃用,但我不会依赖它,因为它可能会被弃用。此外,PCRE 通过 u 修饰符支持 UTF-8。请参阅此答案

mb_ereg is not deprecated, but I wouldn't rely on it because it probably is going to be. Besides, PCRE supports UTF-8 via the u modifier. See this answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文