5

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?

erenon
  • 18,838
  • 2
  • 61
  • 93
enricog
  • 4,226
  • 5
  • 35
  • 54

3 Answers3

5

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...

ircmaxell
  • 163,128
  • 34
  • 264
  • 314
  • 2
    The mbstring library is, however, a non-default extension, so it's not exactly guaranteed to be a part of your environment, assuming you're not the one managing it. – Spencer Hakim Nov 12 '10 at 14:47
5

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.

subosito
  • 3,420
  • 2
  • 24
  • 12
2

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.

Community
  • 1
  • 1
netcoder
  • 66,435
  • 19
  • 125
  • 142