Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107558 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 74317 invoked from network); 16 Oct 2019 16:14:08 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 16 Oct 2019 16:14:08 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id C9DA22C049B for ; Wed, 16 Oct 2019 06:58:32 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Wed, 16 Oct 2019 06:58:28 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id m16so20109942oic.5 for ; Wed, 16 Oct 2019 06:58:28 -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=S+GJvyjQSQZqNM3vGDRw97BICuK1gZHo0ZSUo9cSDPo=; b=esMYNG8LhWFEETK8Lnr/0ephz8YdiAL1WZahzgmq0iWIdnTBrsi0v1lPOpALkWzsDR KEsciOsU19WLzUkzVlNqdFQvWh9xyCwOZSMJtrj9DVE8+VIBDGYRA/L05PZf2gKEd1Qt Xpnov+7/h5GXFDwh+Sne0z4qW4Vl/bKVvlVz7rotRq2a90TS4W89awgp1sQFS9LTQfmk Zr+dd3dNEof2OxTn4Tai+4xz9zDQCy931eJUdC+HD9NOaBxkZZ8HcUTT+pFwtnJg9dJ3 s3scpAo7vmpDS9DVXjcFrbwMia1o79R2+joh6LNtqDU2fZ9BudOHnMkftGBE+Ys0Rvqt RlSQ== 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=S+GJvyjQSQZqNM3vGDRw97BICuK1gZHo0ZSUo9cSDPo=; b=LrvKzewevxpq6X3mT9uomMcG2OJm30P+YZUYTxkhgNqOh1jZmFORqYMR4sipJhOh0c Qsfuz0+tmHVNgF3fWwZtjF3XufDzD/+noj2bRKS4uHn3hPYTVN1Z2r/zSMTwQjW/N4/b 9uuu9ZeLEkM8EH+S3tUVQNcjQMdaxNza9+qHs22CdQaieba4yBdtTWdpI9BXBBFovOn8 UlmfwIOmwBdmRiLr2VN3jnrGpGZ0cb8ivraUfx4APRWajXCoF8GoMboFzztTE5ytf1N6 B3Vrkn+PZwQDYFfD9q8R7zwM6l4Vv4qFNNCoHFd3aZ4SrB0KgFFO6zG9aMqXACp9Tp0I 2SQw== X-Gm-Message-State: APjAAAU22jcKK5jyWHgk921eorgmhg1+0tUQe1sBUGvW6IbS8aPGXsI6 UW2f/wRxVF9aIAWq1UIVvwgpKvf7UPWm2ka160Y= X-Google-Smtp-Source: APXvYqw5KVKFEbSL+VavTnvHnfjyNKNhstpxUJ9WKq4XjCxMfyQyisEZdZ2oMkEK9cTsXtQ+cOznhXb+Eat/atlf7e4= X-Received: by 2002:a05:6808:287:: with SMTP id z7mr3447977oic.139.1571234307551; Wed, 16 Oct 2019 06:58:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 16 Oct 2019 14:58:16 +0100 Message-ID: To: Chase Peeler Cc: Kosit Supanyo , =?UTF-8?Q?Micha=C5=82_Brzuchalski?= , PHP Internals List Content-Type: text/plain; charset="UTF-8" X-Envelope-From: Subject: Re: [PHP-DEV] Inline switch as alternative to nested inline conditional From: robehickman@gmail.com (Robert Hickman) > > > $say = switch (date("w")) { > > case 0 => "weekend!"; > > case 1, 2, 3, 4, 5 => "weekday :("; > > case 6 => "weekend!"; > > }; > > echo "Today is {$say}"; If you had a really long expression, it may be easier to read if the assignment was moved to the end, perhaps like this: switch (date("w")) { case 0 => "weekend!"; case 1, 2, 3, 4, 5 => "weekday :("; case 6 => "weekend!"; // lots more cases ... } => $say; echo "Today is {$say}";