-1

We just upgrade to PHP7 and the eregi function is now not working and I need to convert it to preg_replace. I've looked over a couple other topics which are requesting the same thing. I am having an issue with the syntax.

Current code

$body = eregi_replace("[\]", '', $body);

I've tried the following but it looks like it's not fully working as $body looks to be empty.

$body = preg_replace('[\]', '', $body);

Any help would be appreciated.

Xcodian Solangi
  • 2,342
  • 5
  • 24
  • 52
kaykills
  • 1
  • 2

1 Answers1

0

Why not just check if $body is not empty

if($body!=null) {
$body = preg_replace('[\]', '', $body);

}
Samuel James
  • 1,528
  • 16
  • 15