Add Comment
|
Related Links
|
TrackBack
ereg functions are deprecatedWhile looking at the PHP online reference for ereg, I noticed a huge deprecation notice: Warning Looks like all of the ereg functions (ereg_replace, etc.) are being removed in the new version of PHP. They are all deprecated in favor of the Perl-compatible functions: Note: As of PHP 5.3.0, the regex extension is deprecated in favor of the PCRE extension. Calling this function will issue an E_DEPRECATED notice. My codes are littered with ereg functions. Having to port my code over to use the PCRE extension is not going to be fun. Chieh Cheng I found in many ereg_replace cases, you can simply surround the pattern with '/' when you convert to preg_replace. For example: $line = ereg_replace ('\n', '', $line); Chieh Cheng eregi_replace is for case-insensitive replacements. To substitute preg_replace for this function call, you'll have to use the 'i' modifier. For example: $str = eregi_replace ("%7D", "}", $str); Chieh Cheng For many cases where you are not searching for regular expression replacements, you can simply substitute str_replace instead. For example: $str = ereg_replace (">", "%3E", $str); Chieh Cheng If you use ereg to determine whether a string contains a regular expression, you can replace the ereg function with preg_match. For example: $result = ereg ("\[MOVED\] ", $this->pageTitle) Chieh Cheng
Add Comment
|
Related Links
|
TrackBack
Did your message disappear? Read the Forums FAQ. Add CommentSpam Control | * indicates required field TrackBackTrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites. Send Ping | TrackBack URL | Spam Control No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here. Messages, files, and images copyright by respective owners. |
Products
|
Services
80 Users Online
|
Copyright © 1996 - 2024. All Rights Reserved. |