Deprecated: Function eregi_replace() [duplicate]

百般思念 提交于 2019-11-28 14:27:23

the entire ereg family of functions are deprecated in PHP and will at some point be removed from the language. The replacement is the preg family. For the most part, the change is simple:

preg_replace('/[^<>]>/i', '', $question);
^--           ^      ^^
  1. change ereg to preg
  2. add delimeters (/)
  3. for case insensitive matches (eregi), add the i modifier
$question = preg_replace('/<\/?[a-z][a-z0-9]*[^<>]*>/i', '', $question);

By the way, you can simply use $question = strip_tags($question); to achieve the same without any regexes!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!