Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62291 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51858 invoked from network); 20 Aug 2012 16:47:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Aug 2012 16:47:47 -0000 Authentication-Results: pb1.pair.com header.from=hermanradtke@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=hermanradtke@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: hermanradtke@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gg0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:47747] helo=mail-gg0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/50-07742-13A62305 for ; Mon, 20 Aug 2012 12:47:46 -0400 Received: by ggmo6 with SMTP id o6so5724840ggm.29 for ; Mon, 20 Aug 2012 09:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7kuGLZfUPr5/nGW7TXK52kOwYRZcFkEzF5CchsmQ168=; b=hhX46igt2Yg6iLL49Gm8DRNcw4F5oBiH14R+C7uTuFCvkrLlFzAOKAP/82W4ICs6Sr LEsdTipXQnkem562fGrSIeS+wTmMJjIuZIYy9DJtnsLOopBvDASC6qsU/8nupItnxTro 9ie3p5/cXGvmCj523IkFITNvtwf0gL+yoVQWRgFO66eLRO8NIC1e5+dqKh4BjRYsqIwj n7WaIEAu6V/IFzRqqKjsTYK8FQiEwFhSi7HC7+S8zvGYEgImVGExUsnjQRQSSgsP3xql 2QektmaBSy1btBCrXd2Bt4sQyyEe7G77IV+E7F3D/JIo38d8PC6J6VH03OZ+cxExrqL8 2BcQ== MIME-Version: 1.0 Received: by 10.50.106.136 with SMTP id gu8mr10558158igb.23.1345481262511; Mon, 20 Aug 2012 09:47:42 -0700 (PDT) Received: by 10.64.60.37 with HTTP; Mon, 20 Aug 2012 09:47:42 -0700 (PDT) In-Reply-To: References: <502EB667.1020602@lerdorf.com> Date: Mon, 20 Aug 2012 09:47:42 -0700 Message-ID: To: Yasuo Ohgaki Cc: Etienne Kneuss , Rasmus Lerdorf , Rasmus Schultz , internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8f23579db4374604c7b5445f Subject: Re: [PHP-DEV] re: removing an item from an array From: hermanradtke@gmail.com (Herman Radtke) --e89a8f23579db4374604c7b5445f Content-Type: text/plain; charset=UTF-8 >> 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. -- Herman Radtke hermanradtke@gmail.com | http://hermanradtke.com --e89a8f23579db4374604c7b5445f--