0

I have an application that is now running on PHP 5.3 that was originally developed in a previous version. I receive an eror stating:

Function ereg_replace() is deprecated

referring to the following snippet:

<?php $summary = ereg_replace("<[^>]*>","", $item['item_description'])?>

What changes to the above snippet are required to use preg_replace()?

Tim Cooper
  • 151,519
  • 37
  • 317
  • 271
SidC
  • 3,083
  • 14
  • 64
  • 130
  • * [converting ereg to preg (missing regex delimiters)](http://stackoverflow.com/questions/6270004/converting-ereg-expressions-to-preg) – mario Jan 06 '12 at 19:52

2 Answers2

3

All you need to do is use the function preg_replace() and put delimiters around the expression:

$summary = preg_replace("/<[^>]*>/","", $item['item_description']);
Tim Cooper
  • 151,519
  • 37
  • 317
  • 271
0

And for eregi_replace use:

$summary = preg_replace("/<[^>]*>/i","", $item['item_description']);

Consider the i modifier.