Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45789 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91885 invoked from network); 12 Oct 2009 19:49:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Oct 2009 19:49:45 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 88.198.8.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 88.198.8.16 bigtime.backendmedia.com Linux 2.6 Received: from [88.198.8.16] ([88.198.8.16:55108] helo=bigtime.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/0D-54920-75883DA4 for ; Mon, 12 Oct 2009 15:49:44 -0400 Received: from localhost (unknown [127.0.0.1]) by bigtime.backendmedia.com (Postfix) with ESMTP id E1D79414400B; Mon, 12 Oct 2009 19:50:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from bigtime.backendmedia.com ([127.0.0.1]) by localhost (bigtime.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y2YpQX98u0ox; Mon, 12 Oct 2009 21:50:41 +0200 (CEST) Received: from [192.168.0.151] (217-162-131-234.dclient.hispeed.ch [217.162.131.234]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by bigtime.backendmedia.com (Postfix) with ESMTP id 32AC04144009; Mon, 12 Oct 2009 21:50:40 +0200 (CEST) Cc: internals@lists.php.net Message-ID: To: Joey Smith In-Reply-To: <20091012194828.GA25152@joeysmith.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Date: Mon, 12 Oct 2009 21:49:37 +0200 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> <20091012194828.GA25152@joeysmith.com> X-Mailer: Apple Mail (2.936) Subject: Re: [PHP-DEV] Why is ereg being deprecated? From: mls@pooteeweet.org (Lukas Kahwe Smith) On 12.10.2009, at 21:48, Joey Smith wrote: > 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. Feel free to collaborate with the authors of PHP_Compat [1]. regards, Lukas Kahwe Smith mls@pooteeweet.org [1] http://pear.php.net/package/PHP_Compat