0

For changing to PHP 5,3 ... not sure if I can just change the function name in the below from ereg_replace to preg_replace - if that will result in the same or if the syntax has to be changed as well regarding "[\n\r]" og "\t\t+" - anyone who can tell me that for sure (very hard to test in the given setup environment)...

$line2 = ereg_replace("[\n\r]", "", $line);

$line2 = ereg_replace("\t\t+", "", $line2);

Thanks in advance...

Code Lღver
  • 15,573
  • 16
  • 56
  • 75
Brian Langhoff
  • 151
  • 2
  • 3
  • 13

1 Answers1

0

the given examples should work like this:

$line2 = preg_replace("/[\n\r]/", "", $line);

$line2 = preg_replace("/\t\t+/", "", $line2);

In some cases you need other modifications, too. For example if you used the / inside your regex then you need to escape it like this: \/

please read this thread: ereg_replace to preg_replace?

Community
  • 1
  • 1
steven
  • 4,868
  • 2
  • 28
  • 58