Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108759 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25808 invoked from network); 25 Feb 2020 21:01:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Feb 2020 21:01:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B5B421804F2 for ; Tue, 25 Feb 2020 11:18:53 -0800 (PST) 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f54.google.com (mail-yw1-f54.google.com [209.85.161.54]) (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 ; Tue, 25 Feb 2020 11:18:50 -0800 (PST) Received: by mail-yw1-f54.google.com with SMTP id l5so602601ywd.4 for ; Tue, 25 Feb 2020 11:18:50 -0800 (PST) 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=/59NHf7QznUxj9sZIEYWXX5HPnS6qadlxlMnD6m8DSA=; b=WbaSGBLR2ra9Mpp8jCb0lUvgDFAecRsiROiAFEGRKWi0dGbEQx1vquSfPPYdlsEMqt etO3z4m7lU9gdAoh4SVmxshr9u3MzrRX/loxv8waH6Fi10FBToqQyoz6FHYLhREcQ40b HhHfKd3BYl6/lK+KFEQC0busFkeUpmUiUp50As5jnjVSgU9VhR7gv4+aqQNDR3RW1sOJ C3Sh/YmG00cSL4Ltj19PlTceeouaAA4AgyBAgvr1Ug3NB9xz5X0WyVNMzA929TrGVjDp Y6VqniQB9kFh+7AHriiSGAGkdym/bPvn0psDF+gChlHJZuy1KFPW+7SAOX1PY5CK6iTS BQeA== 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=/59NHf7QznUxj9sZIEYWXX5HPnS6qadlxlMnD6m8DSA=; b=mghJqZMABOQIALNHmnBi5TDsYX+kP/PD4b8Ei4NyG5GYIk9PXZno7KuFFBMrTDcZOQ zaePxrbbSslGzj7LDPN9Xl3EdhJKdGhqtt/Mpbo4IcSHp004CyKRCqL9maMWwZAptWrd lE2lEMhOjlFUD5GSi8tiperuHAl6xSQ2AY4AE8lVef/UUZAfzMXll+9XrAjcz6sPPSnK adiDpJgiLe9kRavyLRt60yAqDEAv/SlalESjKsHtpSmEeIygUmhX71tTteTKWxVDC2aX gNW4ZDLVY+qVzooZzIX+Xq8SYmJ9Ux+ZXCSSESl6tuGf7gL0aN1h2GjBzQK5QaVhjM2l hu3g== X-Gm-Message-State: APjAAAXA2ql1xDoMlofmXgxJWkn04lr9LP+r2EYed1bR3UhXF7pug+/N D4Iy0uZ2Ms/B7BdRWMrJky7F1v7dnuOYn+Yj6wh9Mg== X-Google-Smtp-Source: APXvYqwh4Qu4T3M7v8pgdhrDyqCmgyCZxmo0UHnEDW8VCjW26D9wE9HlYQF+4hctPwkGDDhrBHZzemY9k9KCN/wyDJ0= X-Received: by 2002:a25:be86:: with SMTP id i6mr845672ybk.507.1582658327958; Tue, 25 Feb 2020 11:18:47 -0800 (PST) MIME-Version: 1.0 Date: Tue, 25 Feb 2020 13:18:36 -0600 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000007056ed059f6b5be2" Subject: [PHP-DEV] Thoughts on adopting Python's for/foreach else construct. From: tendoaki@gmail.com (Michael Morris) --0000000000007056ed059f6b5be2 Content-Type: text/plain; charset="UTF-8" I don't remember if this has been discussed before, but I've been working with some listing code and wishing for a cleaner way to do this $value) { // code for iteration } } ?> How difficult would it be to make the following work in the interpreter? $value) { // code for iteration } else { // code for no results } ?> The code of the else clause executes if the foreach is never entered regardless of the reason (provided the code didn't outright crash) Thoughts. --0000000000007056ed059f6b5be2--