troubleshooting Question

Help with PHP: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Avatar of thenelson
thenelson asked on
PHP
5 Comments1 Solution134 ViewsLast Modified:
When I upgrade PHP on my webserver from version 5.4 to 5.6, I get:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home3/thenelson/public_html/barnwellmd/secure/Services/Twilio/Resource.php on line 90

Here is the code around line 90:
/**
     * Return camelized version of a word
     * Examples: sms_messages => SMSMessages, calls => Calls, 
     * incoming_phone_numbers => IncomingPhoneNumbers
     *
     * @param string $word The word to camelize
     * @return string
     */
    public static function camelize($word) {
        return preg_replace('/(^|_)([a-z])/e', 'strtoupper("\\2")', $word);
    }
I went online and read about the /e modifier and preg_replace_callback and I am a bit lost. What does the /e modifier do? Can I just remove the /e modifier from preg_replace? Can I change preg_replace to preg_replace_callback, remove the /e modifier or do I need to do more?

Thanks.
ASKER CERTIFIED SOLUTION
Zakaria Acharki
Analyst Developer
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros