Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45788 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90714 invoked from network); 12 Oct 2009 19:46:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Oct 2009 19:46:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=joey@joeysmith.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=joey@joeysmith.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain joeysmith.com designates 209.90.98.146 as permitted sender) X-PHP-List-Original-Sender: joey@joeysmith.com X-Host-Fingerprint: 209.90.98.146 host-3.pl1071314.fiber.net Received: from [209.90.98.146] ([209.90.98.146:49206] helo=joeysmith.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/CC-54920-CA783DA4 for ; Mon, 12 Oct 2009 15:46:53 -0400 Received: from joey by joeysmith.com with local (Exim 4.69) (envelope-from ) id 1MxQse-00012u-GU for internals@lists.php.net; Mon, 12 Oct 2009 13:48:28 -0600 Date: Mon, 12 Oct 2009 13:48:28 -0600 To: internals@lists.php.net Message-ID: <20091012194828.GA25152@joeysmith.com> References: <20091012154610.GJ5179@arvo.suso.org> <20091012160854.GK5179@arvo.suso.org> <4AD356D5.2020605@lerdorf.com> <20091012162227.GL5179@arvo.suso.org> <20091012165734.GN5179@arvo.suso.org> <20091012173621.GO5179@arvo.suso.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091012173621.GO5179@arvo.suso.org> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [PHP-DEV] Why is ereg being deprecated? From: joey@joeysmith.com (Joey Smith) Write yourself a bit of code that replaces ereg which could be installed in an auto_prepend location server-wide. Here's an example you could start with, although I should point out that I spent all of about 30 seconds thinking about it, so you might want to give it more thought than that - I'm sure there are some funny edge cases in the way people have relied on ereg behaviour, but you'd be more likely to know that than I since I haven't used ereg() since the day PCRE support was added to PHP. if (! function_exists('ereg')) { function ereg($pattern, $string, &$regs = array()) { $matches = array(); $delimiters = array(chr(1),chr(1),chr(1),chr(1),chr(1),chr(1),'/', '@', '#', '%', '_'); foreach($delimiters as $c) { if (strpos($string, $c) !== FALSE) continue; $d = $c; } if (preg_match_all($d.$pattern.$d, $string, $matches)) return strlen($string); return false; } } Much the same could be done for split(), ereg_replace(), and so on.