Hi, I just installed a new script on my website and I'm getting this message: Deprecated: Function ereg_replace() is deprecated in /home/content/68/9317268/html/YourSite/seourls.php on line 23 This is the coding that's on line 23: $return = trim(ereg_replace(' +',' ',preg_replace('/[^a-zA-Z0-9\s]/','',strtolower($input)))); If you can help me I would greatly appreciate it. Thanks.
Just remove it. $return = trim(preg_replace('/[a-z0-9\s]/','',strtolower($input))); does the same thing, as far as I can see.
Sorry @PoPSiCLe, not the same thing. The e-reg is there to condense multiple spaces to a single space... See that space before the plus? Normally I'd assume that's trying to do FULL whitespace compression, in which case I'd go with: $return = trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z0-9\s]/','',strtolower($input)))); * NOTE - I killed off the upper-case check in the regex since it already runs strtolower. Though if you literally just want any number of spaces ONLY, just add the slashes... $return = trim(preg_replace('/ +/',' ',preg_replace('/[^a-z0-9\s]/','',strtolower($input)))); Though that could be even more simply done since patterns are type mixed -- so you can pass arrays. $return = trim(preg_replace(['/\s+/', '/[^a-z0-9\s]/'], [' ', ''], strtolower($input))); I'd go with the \s so ALL whitespace chars are turned into spaces. * NOTE - uses PHP 5.4 style arrays. Though that is REALLY complex and semi-questionable. I'd be wondering about the data that's being scrubbed by that.