Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62229 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27097 invoked from network); 17 Aug 2012 21:50:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2012 21:50:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:55358] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 07/0F-47492-1BCBE205 for ; Fri, 17 Aug 2012 17:50:42 -0400 Received: by lbbgp3 with SMTP id gp3so2476313lbb.29 for ; Fri, 17 Aug 2012 14:50:38 -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=+98S9wSVQmoVZM61RTDKqedhKIhnWlLsh1c9FYy3QlU=; b=it1rHvZ5UNotPAsbhYml+FAdbjwOyjFIofTLVLbac6o7f+xeVegHRDnxQX/b3Vcy98 Sq1w6q97S+9CsnIUhGtG44f2XuPXtoSCY89q7X46L8d5fatIh/PN7+SwGdrZiH1PIh6N i4N1KWLMOkc5YmPBfXPCMtiiPd9wVvwqLSryseppCkIvF7DYJDCpD8RliAume5fpt/E7 ZANcClceRHqsTa6sTdh+lRdhzZFwqQlAgJ2atUSdO85VrwYAOBwos28EutugSvYxArOg IZay/TVOZ9dHg6OizvA0nXyh+cwdVT6A0oNK19f/FUxxqEOMFju67snZNyUvn7iYfe3h DEgw== MIME-Version: 1.0 Received: by 10.152.124.180 with SMTP id mj20mr6247609lab.43.1345240238331; Fri, 17 Aug 2012 14:50:38 -0700 (PDT) Received: by 10.152.122.51 with HTTP; Fri, 17 Aug 2012 14:50:38 -0700 (PDT) In-Reply-To: References: <502EB667.1020602@lerdorf.com> Date: Fri, 17 Aug 2012 23:50:38 +0200 Message-ID: To: Rasmus Schultz Cc: Rasmus Lerdorf , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] re: removing an item from an array From: nikita.ppv@gmail.com (Nikita Popov) On Fri, Aug 17, 2012 at 11:35 PM, Rasmus Schultz wrote: > Most other languages have more than one collection-type... since PHP has > only the single, hybrid array-type which acts both as a hash and as an > array, something like this ought to be available. > > I don't know why everyone is so eager to jump up and argue against > something this simple, basic and useful. The fact that this is missing is > an oversight - just look at the number of solutions people come up with. > For what? Could we please stop these pseudo-arguments? "simple, basic and useful. The fact that this is missing is an oversight"? Do you have anything to back up these claims? I can't remember to have been in a situation where I wanted to remove a value from an array. Simply because that's a slow operation. When you have to do it you *usually* have chosen the wrong datastructure. And in the cases where you do need it, you can easily do it with array_search. Where is the issue? Also, as I already pointed out, "removing a value from an array" is not well defined. Do you mean to only remove the first occurrence of the value? Only the last? All of them? Do you want to have special functions for all of those? Furthermore, why do you keep coming back to the "There exists more than one solution to this problem" argument? Everything can be done in a large number of ways. And people come up with a lot of ways, depending on the situation. You can output a string with echo, with print, with concatenation, with interpolation, with multi-arg echo, with printf, etc. So sure, there are also multiple ways to remove values from an array. What's the issue with that? Nikita