Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62324 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11591 invoked from network); 21 Aug 2012 00:01:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2012 00:01:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=wfitch@meetme.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=wfitch@meetme.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain meetme.com designates 74.125.149.73 as permitted sender) X-PHP-List-Original-Sender: wfitch@meetme.com X-Host-Fingerprint: 74.125.149.73 na3sys009aog104.obsmtp.com Linux 2.5 (sometimes 2.4) (4) Received: from [74.125.149.73] ([74.125.149.73:41552] helo=na3sys009aog104.obsmtp.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/E3-28202-9CFC2305 for ; Mon, 20 Aug 2012 20:01:14 -0400 Received: from mail-vb0-f44.google.com ([209.85.212.44]) (using TLSv1) by na3sys009aob104.postini.com ([74.125.148.12]) with SMTP ID DSNKUDLPxq65puQS8pohOU7cn/OaxWxc+Gje@postini.com; Mon, 20 Aug 2012 17:01:13 PDT Received: by vbbez10 with SMTP id ez10so8017985vbb.17 for ; Mon, 20 Aug 2012 17:01:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=GnYmlFR/6KKCpVbNKuXDx7zdZLfvEoiKrUqhn40zeJQ=; b=FUUJufghJXEMNGyjobQjNXaY3eD6cBymqJhU4i7Sc04YcOViarRitWH5PVjxfgQOLk lEW6NurNW7sG3+wgeRUx9P2H2dDMfZHmjTTxDe2A9E6Mu2FDgOd5K1+zi+6OdOBTDWm9 08geuWzNzEpMGQbFaEmCD/avmlNHTEVsjcNUdMAINUUX3c5LyE7KpaFRzpu5Zd6sTDI0 zEnYr8/MybJPnXeGqD4Jsv3mt2HWHq4fu0e7w1AF3PyBXay/76XvHutbUfrmy7yjjpsf HpuVyjEJySuUS6Dx7dSKuhh6+aVyIEtNHmoq1GC+s54RpqYrFiGDf7lG6jpwYN2i9rl9 ZFvQ== MIME-Version: 1.0 Received: by 10.58.234.104 with SMTP id ud8mr12263613vec.3.1345507269956; Mon, 20 Aug 2012 17:01:09 -0700 (PDT) Sender: wfitch@meetme.com Received: by 10.58.132.161 with HTTP; Mon, 20 Aug 2012 17:01:09 -0700 (PDT) X-Originating-IP: [198.228.207.36] Received: by 10.58.132.161 with HTTP; Mon, 20 Aug 2012 17:01:09 -0700 (PDT) In-Reply-To: References: <502EB667.1020602@lerdorf.com> Date: Mon, 20 Aug 2012 20:01:09 -0400 X-Google-Sender-Auth: YZrlDn6W0FfsK3t6xsdKqoxJ4ow Message-ID: To: Yasuo Ohgaki Cc: Etienne Kneuss , internals@lists.php.net, Rasmus Lerdorf , Herman Radtke , Rasmus Schultz Content-Type: multipart/alternative; boundary=047d7b86c7f8de533004c7bb52d2 X-Gm-Message-State: ALoCoQmHDsKRt8kgbBAiNnrdKtkzr0fQz+rdlevRilY/cotyac+WHq0U8wjS8UybiEeb19xnTkGV Subject: Re: [PHP-DEV] re: removing an item from an array From: willfitch@php.net (Will Fitch) --047d7b86c7f8de533004c7bb52d2 Content-Type: text/plain; charset=ISO-8859-1 Please let this die until someone is serious enough to come up with an rfc. This has been nothing but counterproductive arguing. If someone feels strongly about it, write an rfc then we can discuss? On Aug 20, 2012 7:53 PM, "Yasuo Ohgaki" wrote: > Hi, > > 2012/8/21 Herman Radtke : > >>> May be we should have something like > >> > >> >> > >> >> array_delete_if($array, function($v, $k=null) { if ($v == 300) return > >> >> true; }) > >> > > >> > So array_filter? > >> > >> I'll use it or like for deleting, but the point of this thread is > >> "intuitive function for deleting element(s)" > >> > >> array_delete($array, $value|callable) > >> > >> would be nicer for users, perhaps. > > > > > > You are basically asking to alias array_filter with "array_delete". That > is > > a very slippery slope. I think array_filter is very a very obvious > choice to > > remove something from an array. The "filter" function/method is common in > > functional languages (and functional frameworks like Underscore). > > > > These are things developers just need to learn as part of development. > > Really, this is entire thread should be on stack overflow, not internals. > > I guess you haven't read later post. > > You've also made a novice mistake. > array_filter() DO NOT delete elements, but creates new array. > array_delete() is another form of array_walk(), not array_filter(). > See my posts. > > Having a API for dedicated task is good thing. > Who would argue array_pop()/array_push() isn't needed? > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7b86c7f8de533004c7bb52d2--