Reputation: 29
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.
Upvotes: -2
Views: 234
Reputation: 2323
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);
Upvotes: 0