Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45798 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21670 invoked from network); 12 Oct 2009 23:54:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Oct 2009 23:54:17 -0000 Authentication-Results: pb1.pair.com header.from=jvalade@eoni.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jvalade@eoni.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain eoni.com designates 216.228.192.7 as permitted sender) X-PHP-List-Original-Sender: jvalade@eoni.com X-Host-Fingerprint: 216.228.192.7 adam5.eoni.com Windows 2000 SP4, XP SP1 Received: from [216.228.192.7] ([216.228.192.7:3779] helo=adam5.eoni.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/E2-04914-8A1C3DA4 for ; Mon, 12 Oct 2009 19:54:17 -0400 Received: from eoni.com (unverified [216.228.192.10]) by adam5.eoni.com (Vircom SMTPRS 4.4.568.54) with ESMTP id for ; Mon, 12 Oct 2009 16:49:48 -0700 X-Modus-BlackList: 216.228.192.10=OK;jvalade@eoni.com=OK X-Modus-Trusted: 216.228.192.10=YES X-Modus-Audit: FALSE;0;0;0 Message-ID: <1c00dc04f55e49e38efc94aa7204c53a.jvalade@eoni.com> X-EM-APIVersion: 2, 0, 2, 6 X-Priority: 3 (Normal) To: internals@lists.php.net Date: Mon, 12 Oct 2009 16:46:41 -0700 MIME-Version: 1.0 Content-type: text/plain; charset=utf-8 Subject: Re: [PHP-DEV] Why is ereg being deprecated? From: jvalade@eoni.com ("jvalade@eoni.com") Mark Krenz wrote: > On Mon, Oct 12, 2009 at 05:55:25PM GMT, Carl P. Corliss [rabbitt@gmail.com] said the following: > >> Code Search of: "eregi?(_replace)?\( lang:php" shows ~123,000 results >> Code Search of: "preg_(filter|grep|last_error|match_all|match|quote|replace_callback|replace|split)\( lang:php" shows ~374,000 results >> >> Looks like preg_* functions are used more often than ereg* functions to me... >> > > I think everyone should read this as it will prove my point. > Especially book #9 > > I have a O'Reilly Safari Books Online account and can search the > content of many of the latest books, which I consider something more > official than just doing a causual Google search, which can be > misleading. > > The number 1 selling book on Amazon in the PHP category is "PHP and > MySQL Web Development" (4th Edition) from 2008 by Luke Welling and > Laura Thomson. > > There is no mention of preg_match and the book instead shows how to > use ereg based functions. In fact, they do mention PCRE, but downplay > it by saying that POSIX regexs are easier to use. > > > I think any intelligent person would see this as a alarm that the PHP > world isn't ready for ereg to be dropped or changed. You need far more > time for the information to make its way through the PHP community. > > > Going further through the list of Amazon's top selling PHP books we > have: > > 2. The Essential Guide to Dreamweaver CS4 with CSS, Ajax, and PHP (Essentials) > > Ignore this as it isn't really covering PHP properly. > 3. Regular Expression Pocket Reference: Regular Expressions: from 2008 > > This states that it covered PCRE expressions for PHP. So at least > that's right. > > > 4. Learning PHP, MySQL, and JavaScript: A Step-by-Step Guide to Creating > Dynamic Websites from 2009 > > Uses examples written with preg_match > > 5. Web Database Applications with PHP and MySQL, 2nd Edition from 2004. > > Mentions PCRE but says that they will use POSIX expressions instead. > > 6. Head First PHP & MySQL from 2008/2009 > > Talks about preg_match, mentions that ereg is removed in PHP 6. > > 7. PHP Cookbook from 2006 > > Has mixed examples, some using ereg and some using preg_match > > 8. Practical Web Practical Web 2.0 Applications with PHP > > Not on Safari > > ----> 9. Programming PHP by Kevin Tatroe, Rasmus Lerdorf and Peter > MacIntyre in 2006. Which may be considered the definitive guide to PHP > since Rasmus is a co-author. > > Uses examples with both ereg and preg_match, BUT ereg is used first in > the book and compromises the majority of the section called "Regular > Expressions". So here is an example of emphasis being placed on ereg > being the more official functions to use. > > 10. Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems > > Not on Safari > > So that's about 4 out of 7 the top selling books on PHP still strongly > use ereg. I didn't find any mention in the books I read online about > ereg going away. Some of them supported PCRE more than others. But > obviously there is still a lot of use of the POSIX functions. > In PHP Cookbook, the only use of ereg I found was in the section where the books was explaining how to convert from ereg to preg_match. Or an occasional mention that said you could do it with ereg but preg_match was better. But, I might have missed something. Practical Web 2.0 Applications with PHP, published in 2008, uses PCRE functions. Wicked Cool PHP, published in 2008, uses the PCRE functions. The book PHP & MySQL Web Development For Dummies, published in 2008, uses only PCRE funcitons. Doesn't even mention ereg. PHP & MySQL for Dummies sells pretty well. Its fourth edition will be released next month. It uses only PCRE, does not mention ereg. So, it appears that around 2007 most authors recognized that they needed to begin moving readers to the PCRE functions. Janet > > > >