Bl4ckMaj1k Posted May 19, 2011 Share Posted May 19, 2011 $customer_contact_id = preg_replace("`", "", $customer_contact_id); Am I doing something wrong? Every page that used the eregi_function, I changed to have it utilize the preg_function (because I saw a Youtube video telling me to do so). Now, every variable I perform the above on acts as if it doesn't exist. This has totally destroyed my system. What do I need to do here to fix things? Link to comment https://forums.phpfreaks.com/topic/236905-replacing-ereg_replace-and-eregi_replace-with-preg_replace/ Share on other sites More sharing options...
AbraCadaver Posted May 19, 2011 Share Posted May 19, 2011 preg functions need pattern delimiters: $customer_contact_id = preg_replace("/`/", "", $customer_contact_id); However, if you don't need regex, this is easier and faster: $customer_contact_id = str_replace("`", "", $customer_contact_id); Link to comment https://forums.phpfreaks.com/topic/236905-replacing-ereg_replace-and-eregi_replace-with-preg_replace/#findComment-1217787 Share on other sites More sharing options...
Maq Posted May 19, 2011 Share Posted May 19, 2011 The video told you to do that because eregi has been deprecated since 5.3. Link to comment https://forums.phpfreaks.com/topic/236905-replacing-ereg_replace-and-eregi_replace-with-preg_replace/#findComment-1217797 Share on other sites More sharing options...
Bl4ckMaj1k Posted May 19, 2011 Author Share Posted May 19, 2011 preg functions need pattern delimiters: $customer_contact_id = preg_replace("/`/", "", $customer_contact_id); However, if you don't need regex, this is easier and faster: $customer_contact_id = str_replace("`", "", $customer_contact_id); Worked just fine, thanks!! The video told you to do that because eregi has been deprecated since 5.3. Hmm....why do they deprecate functions anyway? eregi_replace still got the job done...what made someone make another function which does the exact same thing? Link to comment https://forums.phpfreaks.com/topic/236905-replacing-ereg_replace-and-eregi_replace-with-preg_replace/#findComment-1217799 Share on other sites More sharing options...
AbraCadaver Posted May 19, 2011 Share Posted May 19, 2011 PCRE (Perl Compatible Regular Expressions) used in preg functions are generally faster than and have additional functionality beyond POSIX which is used in the ereg functions. Plus, with the popularity of Perl, they may be more widely known and used. Link to comment https://forums.phpfreaks.com/topic/236905-replacing-ereg_replace-and-eregi_replace-with-preg_replace/#findComment-1217801 Share on other sites More sharing options...
Maq Posted May 20, 2011 Share Posted May 20, 2011 PHP keeps a change log including deprecated functions for each version. Here is 5.3.x: http://php.net/manual/en/migration53.deprecated.php Link to comment https://forums.phpfreaks.com/topic/236905-replacing-ereg_replace-and-eregi_replace-with-preg_replace/#findComment-1218041 Share on other sites More sharing options...
Bl4ckMaj1k Posted May 20, 2011 Author Share Posted May 20, 2011 Thank you all so much for the information!!!!! This can be marked as SOLVED!!!! Another one bites the dust :-) Link to comment https://forums.phpfreaks.com/topic/236905-replacing-ereg_replace-and-eregi_replace-with-preg_replace/#findComment-1218199 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.