Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62224 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17667 invoked from network); 17 Aug 2012 21:21:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2012 21:21:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.212.42 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:40056] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/EC-47492-BC5BE205 for ; Fri, 17 Aug 2012 17:21:15 -0400 Received: by vbbfs19 with SMTP id fs19so4295813vbb.29 for ; Fri, 17 Aug 2012 14:21:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=lscpbbZ+0+vPboPXGI/INM7Il9xe4k/cGQh/XFEPuAw=; b=CsvYg8/ezilbgsgUHUFvHX9r7BBfgJtaF/0IHCS/QjEKqJZjs5uCN7R8PPP06JDAve BsrJSqGbf4Pw+l0U7dQXdzYUjkrRYpis/WwvmLCQtog2+K7oNb8osJUtdMfSccV0OaZZ fM9aAYR2P/mtWvPjZFCjq63KE6DTFAVaWw53nLMNUlBcTHHtpwqHhfho179H4glxODHG Ia1xfhFGjE0XQjLE2vLwpgs3bCKtBLM6JneUpSZnFEiOnyrNMyFBn/McFEXeI7l/d0iH uK2qO3ru7IuR7l8arybN6vUwE2ooePEBM4UzrKaAHY4521/xSnCUSUGdjC9EvV9oyA6m soSw== MIME-Version: 1.0 Received: by 10.52.99.138 with SMTP id eq10mr3094388vdb.25.1345238472320; Fri, 17 Aug 2012 14:21:12 -0700 (PDT) Received: by 10.220.24.3 with HTTP; Fri, 17 Aug 2012 14:21:12 -0700 (PDT) Date: Fri, 17 Aug 2012 17:21:12 -0400 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=20cf3071cc4a47e5c504c77cbd54 X-Gm-Message-State: ALoCoQllvrmO5tBMnlF43hj5h7GfZWG0mzQs0p35INZuJ03nMi3OyvgMJdPjCGw2uhXZp39vh0qK Subject: re: removing an item from an array From: rasmus@mindplay.dk (Rasmus Schultz) --20cf3071cc4a47e5c504c77cbd54 Content-Type: text/plain; charset=ISO-8859-1 > > if(($key = array_search($del_val, $messages)) !== false) { > unset($messages[$key]); > } > > Nothing horrible here. > I disagree - this is (or should be) a simple, atomic operation... yet, you've got a function-call, an intermediary variable, a boolean test, and an unset statement repeating the name of the array you're deleting from. This should be a simple statement or function/method-call, and in most other languages it would be... --20cf3071cc4a47e5c504c77cbd54--