-7

Deprecated: Function ereg_replace() is deprecated in /home/hjlhvqyy/public_html/fastseoindia/klib/k_functions_text.php on line 114

The code is below:

$value = ereg_replace("[ ]{2,}"," ",$value); // line 114

Please, help me and give me a real code. I can't understand the full code, that's why I post my own question to get direct answer, because I can't make my own code to see the examples.

So, help me...

MC Emperor
  • 22,334
  • 15
  • 80
  • 130
  • possible duplicate of [How can I convert ereg expressions to preg in PHP?](http://stackoverflow.com/questions/6270004/how-can-i-convert-ereg-expressions-to-preg-in-php) – HamZa Nov 05 '13 at 08:51

3 Answers3

3

You need to use preg_replace because ereg_replace isn't supported anymore.

Joran Den Houting
  • 3,149
  • 3
  • 21
  • 51
0

I think it's

$value = preg_replace('/\s/' , ' ' , $value);
Developerium
  • 7,155
  • 5
  • 36
  • 56
-1

The function ereg_replace() is deprecated, that means that it is no longer supported by PHP by a particular reason (can be security or performance reasons, for example).

Instead, use preg_replace(). You also need to replace the regular expression string

[ ]{2,}

to

/[ ]{2,}/

Read more about pattern delimiters.

MC Emperor
  • 22,334
  • 15
  • 80
  • 130