PHP ereg vs. preg

后端 未结 5 941
猫巷女王i
猫巷女王i 2020-12-15 15:45

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 d

5条回答
  •  孤城傲影
    2020-12-15 16:07

    preg is the Perl Compatible Regex library
    ereg is the POSIX complient regex library

    They have a slightly diffrent syntax and preg is in some cases slightly faster. ereg is deprecated (and it is removed in php6) so I wouldn't recommend that it is used.

提交回复
热议问题