Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62350 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23329 invoked from network); 21 Aug 2012 19:13:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2012 19:13:54 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:34835] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/82-10139-0FDD3305 for ; Tue, 21 Aug 2012 15:13:53 -0400 Received: by wgx1 with SMTP id 1so108503wgx.11 for ; Tue, 21 Aug 2012 12:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=2H+8txKlC7c81E4orH8QOd4oW2nMxdN/jU00h9ayw68=; b=FoxmkAo8b05RNPZ13cYQaXi+xtb++dX7e9ogIndA4IWXmfKP7EBDNdsa2IRqT5r1yV pnfK7qRhi8hpJz918C+KgFcb/nWxvWvtTgaQvHpjoJdal59NQ8swdzPowPewAAouQ6+d lBBArqnXPrmowwxgGoC9S2OHmlO/iDA+rBtu4uOI1w6ZsmcjwAZH9kIGjjXocTJWg4Yl 1kgoCQ20uocPwHTjNMpQQvDB9PNFP3bH2fG3pIPRvnndBM/zB0PJ7aamo3fYkVbF/ifm iv1USmAggh2xDSJh2xyeNoYSeoBPNMORa/AODVPopUgyG/lpUPOn2wnDnkyn1TkzdhQa bakA== Received: by 10.180.105.6 with SMTP id gi6mr40342104wib.4.1345576429590; Tue, 21 Aug 2012 12:13:49 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.223.86.201 with HTTP; Tue, 21 Aug 2012 12:13:09 -0700 (PDT) In-Reply-To: References: <502EB667.1020602@lerdorf.com> Date: Wed, 22 Aug 2012 04:13:09 +0900 X-Google-Sender-Auth: jp9uJ8mMswksVhLyYxAM4FA9XG8 Message-ID: To: Levi Morrison Cc: Tjerk Anne Meesters , Rasmus Schultz , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] re: removing an item from an array From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi 2012/8/22 Levi Morrison : > On Tue, Aug 21, 2012 at 12:53 PM, Yasuo Ohgaki wrote: >> 2012/8/21 Levi Morrison : >>> >>> I'm against this RFC, but if you are going to even try to add >>> something, please keep it consistent! Don't modify `array_delete` to >>> take a callable, instead make a different function `array_udelete` or >>> something. >>> >> >> Original proposal is adding array_delete() and this is under discussion. >> We don't have to add array_add() >> >>> And keep default $strict values consistent with existing functions >>> that have that parameter. >> >> Users should use array_walk() when they would like to delete element(s). >> To be consistent, it should be callable. >> >> Regards, >> >> -- >> Yasuo Ohgaki >> yohgaki@ohgaki.net > > I didn't say anything about `array_add`. I meant to say if you are > going to try to add something to the core that you need to be > consistent with the other array functions. > > Why use `array_walk` to delete elements? Isn't the whole point of > `array_delete` to make that process easier? > The reason why use array_walk is this is the best way to delete elements with PHP. From the Stack Overflow's page (and this thread), we can tell the problem is lack of intuitive API for array element deletion. > I think you missed the whole point of my last message: keep the > functions you propose similar to ones that already exist. That's my point, too. array_walk() is there from PHP3 at least, IIRC. array_delete() is easier to use, too. i.e. No "use (&$array)" for closure and counter variable when user would like to know how many elements were deleted. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net