-2

I have the above error that I am struggling to fix, the code can be seen below:

$anchor = ereg_replace($pattern, '', strtolower($string));
            $pattern = "([[:space:]]|[[:blank:]])+"; 
            $anchor = ereg_replace($pattern, '-', $anchor);
            return $this->short_name($anchor); // return the short filtered name 

Just to add, I have amended to this:

 $anchor = ereg_replace($pattern, '', strtolower($string));
            $pattern = "/([[:space:]]|[[:blank:]])+/"; 
            $anchor = ereg_replace($pattern, '-', $anchor);
            return $this->short_name($anchor); // return the short filtered name

But still the error persists and it points to the first and 3rd line as the problem.

Any help appreciated, i have look at other threads and Google but couldnt find the resolution.

Thanks.

user1764987
  • 29
  • 1
  • 5
  • 1
    Googling this would've given you many results as well as solutions. All that needed to be done was to so use a starting and ending `/` - `$effort_on_your_part="NULL";` - Plus, did you not bother looking over to the right under **"Related"** >>> - ? – Funk Forty Niner Feb 05 '14 at 17:45
  • I cam here as I had tried Googling it but despite multiple amendments I couldnt fix. – user1764987 Feb 05 '14 at 17:50

1 Answers1

0

ereg_* functions are deprecated user preg_* functions. Don't forget to surround you pattern with delimiters like below.

$pattern = "/([[:space:]]|[[:blank:]])+/"; 
$anchor = preg_replace($pattern, '-', $anchor);
Michal Brašna
  • 2,293
  • 13
  • 17