Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111722 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71919 invoked from network); 30 Aug 2020 16:07:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Aug 2020 16:07:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BDE351804AA for ; Sun, 30 Aug 2020 08:11:36 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 30 Aug 2020 08:11:35 -0700 (PDT) Received: by mail-oi1-f174.google.com with SMTP id z195so5006763oia.6 for ; Sun, 30 Aug 2020 08:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=+N1PSkPiaWrxMg4swihWNxqsVO5gtw4+1o76IEJ/Yco=; b=sEqILejQfZhHspG35PzQ8cwG7lfexbjkUsI18NyJQ3b4XUVy5MFsKirK3xcg9shmCe XwT/wMKKu7o56qim37sv2q9k5dMoj53kmoaQCGfUNKMaoqDNIVs/mLNPzJUKqtZ2yJKh nI8Fk3VZuFQfnrwoPFDo4x7YrYaHl1O6kXv31ZmzyiAIscfqMwfou+Fzwu6Sf0WAgRy/ ndQlMfw35G9ZYfJn0DQ+D4qcyXSSPIJHVNeM7DGbJ4vIkCJ5sLhpACu0NNyyAxwXBaef W7KO8IK4aI3q9fdaytCc8YW6uA/b+6OpL6TsEkqghp12dfIqT2+hzsAfTYVdglHeDqnI Nrvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=+N1PSkPiaWrxMg4swihWNxqsVO5gtw4+1o76IEJ/Yco=; b=A0crOMtTAhhul4VkAFNi0suBO0NSxbGKiThuTfnwks5MGL8L1gVM4EJ5MCLdJedoMW MIioLXPXE2wlIvn/RLIr5GPjzj8bXh3C//jf/KGls5w1J3+e9d3gtjztkoSSqS9+6bJZ eR6qOeRvs4CCBhDM6soTImCYmuJX5DDTsgP7pyJfZDq/RIWme95SszKT6mXx5UPj6Mjl H2Ss2QTkTlMTpOZ2cxdFdsGmLMcRuuxiNOpjB57sPhN2I35JvbDRR8nq4OjNTWsNE/b0 6lTvfEZ3oJAYZeVPx3goT7tagCeC3iAiCBZ15UPkBsJX1SllMDA5Vipd0hRWYOF+MJIi LAvg== X-Gm-Message-State: AOAM530qP1XgxKXicmYIpFKFOzVDHL9bl0tORH5C+zO1h7lbBahmPUS6 ML9JGWazlts+SkfKRTHLwZX5CudSSv9FQ4cYuo4rD8qo X-Google-Smtp-Source: ABdhPJzb55gYX2uCqcU2kIR2u7PFKa+xji908C6GWIKp6jw80qfDz5nqTxtewj2yBXJtK1QvDBZGbS2ct2g2PYpSfA0= X-Received: by 2002:aca:3a08:: with SMTP id h8mr1303734oia.164.1598798327867; Sun, 30 Aug 2020 07:38:47 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 30 Aug 2020 11:38:36 -0300 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="000000000000666fc105ae193eff" Subject: array_reject() as counterpart of array_filter() From: david.proweb@gmail.com (David Rodrigues) --000000000000666fc105ae193eff Content-Type: text/plain; charset="UTF-8" Currently we have array_filter(), but sometimes we need an inverse function like array_reject(). array_reject('is_null', [ 1, 2, null, 3 ]); // [ 1, 2, 3 ] It could be easily implemented with: function array_reverse($fn, $arr) { return array_filter(fn($item) => !$fn($item), $arr); } Anyway, I think that It should be implemented by core, once that we have array_filter(). --000000000000666fc105ae193eff--