Are phps mb_ereg functions safe to use (due to ereg being deprecated)?
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 deprecate开发者_JAVA技巧d soon or is it even a flaw in the documentation?
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...
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
.
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.
精彩评论