Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111831 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31280 invoked from network); 3 Sep 2020 17:06:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Sep 2020 17:06:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 00F6C180532 for ; Thu, 3 Sep 2020 09:12:11 -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-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.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 ; Thu, 3 Sep 2020 09:12:10 -0700 (PDT) Received: by mail-lj1-f174.google.com with SMTP id c2so4354872ljj.12 for ; Thu, 03 Sep 2020 09:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QarQocY3nv4jih09Nia5Yal9nyGm5A0husu+ftLsPYQ=; b=MbR/mRlxJxqpQBIzPEz817+G4XE6m96YjCeUxgnLoSK2CVxK1P4d+uNnIm16ZpB3EF QXvwV2VBn0ZVLBCIaEt/oPwQE2EHHJz2k3m5JgDmkNakee69ULmmWyleC0cOiWP/13Qn 5Ytl8YKNyFSLS4AfP0PFd3DeO/CpY4x+OoxOQ0A5P+MIXuryKJL59Epvgulc0kFFp1Pl gQZzirvnUC4PusUrkvyryvuZdlJqZhm97jZ1OlFoX/+Tb5D6a+jaAMFxHlsshPhHe7qQ qQ+LHekK+swiaKffbvYNdThKTFv79lNWrb/NeCxnS7MhQYALlneTx86Egk42aCv3FxN0 sSFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QarQocY3nv4jih09Nia5Yal9nyGm5A0husu+ftLsPYQ=; b=Dn5bV5bS4OTW32+Y7dUna9cdGUX5FIE7gCAZgiOCNwA3awUlPr42YaGRJncOz+a1sI aDO4cBjSJkWFSf+iiVcF6ZGsQZFziCVsQwxax/v7UQ0iYszzsGOtAD1ZkKrTN0y84sKk bRKV2so+tonu43rG7aj9goOByJyTARl76j5kMrJxtfbZOuvfE9d0B0lwCWD2GynfJIxh jiiZMUCN15atcUkRN8nEhXWjitA54t4Mrlhryzwlsd+a6QuM9l1EQGBnZ2sGVSTl8DbH HddS4pfte+jZqkodoHIomKdRwf6B0NRGPWO3Eb6vCFVG2JLiomwUacwvKrJmjczjwzKl NrFQ== X-Gm-Message-State: AOAM532JRBOvh+4UOAnr6GitibAkFAMNQJLsiyOugm+wQdCOzbz8Aklo 77VKBBu8ALRQFyXlbhgnOoDF8suEEo24j+WdE08= X-Google-Smtp-Source: ABdhPJwNM2RT6zhUbJSPmt4u6TM9uBleRskHpnwCcoC8RL8InCdeDt+Qwckj6VPJjWvXFEW3AWqvhOLVgWHIdurR8LM= X-Received: by 2002:a2e:9c95:: with SMTP id x21mr1684471lji.96.1599149529462; Thu, 03 Sep 2020 09:12:09 -0700 (PDT) MIME-Version: 1.0 References: <89FF9360-609A-439F-BDBE-B3B4C141E00F@newclarity.net> <20200903095840.4b83640d@mcmic-probook.opensides.be> In-Reply-To: Date: Thu, 3 Sep 2020 19:11:57 +0300 Message-ID: To: Sara Golemon Cc: David Rodrigues , PHP internals Content-Type: multipart/alternative; boundary="000000000000a57aed05ae6b033a" Subject: Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values From: benas.molis.iml@gmail.com (Benas IML) --000000000000a57aed05ae6b033a Content-Type: text/plain; charset="UTF-8" On Thu, Sep 3, 2020, 7:05 PM Sara Golemon wrote: > On Thu, Sep 3, 2020 at 10:35 AM David Rodrigues > wrote: > > > Do you think that it could be proxied? I mean, optimize foreach > > (array_keys()...) syntax to not call array_keys() in fact, but a > optimized > > version of foreach to handle key only. I don't know it opcache could do > > that, and if it already does. > > > > > I wouldn't use the word "proxied", but yes. In my mind the compiler would > see: > > foreach(\array_keys($arr) as $key) { > > and quietly transform that into: > > foreach ($arr as $key => $_unusedVariableNameThatIsntEvenSpilledToTheScope) > { > > Thus not iterating the array twice and creating a temporary array of key > names. > Good idea; since I'm kind of bored, I'll try to implement a prototype myself during my free time. -Sara > --000000000000a57aed05ae6b033a--