Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100175 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37751 invoked from network); 10 Aug 2017 22:01:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2017 22:01:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=devnuhl@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=devnuhl@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.169 as permitted sender) X-PHP-List-Original-Sender: devnuhl@gmail.com X-Host-Fingerprint: 209.85.161.169 mail-yw0-f169.google.com Received: from [209.85.161.169] ([209.85.161.169:36108] helo=mail-yw0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/F1-34801-7A7DC895 for ; Thu, 10 Aug 2017 18:01:11 -0400 Received: by mail-yw0-f169.google.com with SMTP id u207so12885616ywc.3 for ; Thu, 10 Aug 2017 15:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=f4R3PY04jj3DTg79Db9+F7OSAL+XIuCVFMnHRUNUwd0=; b=sflEV+PyoHRjaWmo6bp6wdzdGM5GpnQEtiIy+8FrhhYDZ0mRtzfTHR1lwkeyYo57ui +6bglObkq9C6gB/e4lqR/9UN3EfyHrhVuC4Lfm4iutKKNWySpqOU+nCDbl5CtkCi5e04 MlwID5Kcsziay+XMEno8LuEgtCaIVaibkx5OBz0Cnmnm3hj0qTK5fEhxzSny8S+2c2zq bsHI1yD2E03nYE064tcP/kadDVSIcXWB30mXWhevIXgjjYbD1bSj56pcFHCGxvbPZ+a8 JBNZfp7CB7yupm56BejOjGjKSAlwL+dSeBMOrI2u4m0NxMGM1rwxNqP6KSelWB5FA9fo h/pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=f4R3PY04jj3DTg79Db9+F7OSAL+XIuCVFMnHRUNUwd0=; b=K0f5aCvfIPSjMKBEY4uCC8jPVWIjtAb2faelPQ8tR9bU3jk6clCTIj4Zd+9i2XV7UG W1O6/esVYJUw41dwZIw+V1fquc76irp1R7D8F3IYfjYHxl520p95Efpg89tigsGSJ3Oi QNRj4La2roKPvbRSWmlUDs0LKNWNncnpolK2sTF70Dnu01e8fEk855DRwOGtI1/j6P03 ufknTKMrMzjX3TR9TI72s7xEHz/dtuqI6u/uBJzwU+ecHKmn+BP0uLj7AyT1gTtBA1PU wJ9ZAkuv9QQSByPrVDUOZTjjG8bqOdDvr+tIPWjVz9YOD9vd+WQGEGC64vp2UoHrDrK8 8M5Q== X-Gm-Message-State: AHYfb5gZmFnCVN2XdPtoHes0YjcuFL7fuCkQ6x+VYRCRCSCYi1/0jl53 FZte76eJ/S+0W9X3ys8vx87bHD8o5g== X-Received: by 10.13.233.65 with SMTP id s62mr10594999ywe.226.1502402468398; Thu, 10 Aug 2017 15:01:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.126.131 with HTTP; Thu, 10 Aug 2017 15:01:07 -0700 (PDT) Received: by 10.37.126.131 with HTTP; Thu, 10 Aug 2017 15:01:07 -0700 (PDT) In-Reply-To: References: Date: Thu, 10 Aug 2017 17:01:07 -0500 Message-ID: To: Sara Golemon Cc: Dan Ackroyd , Andreas Hennings , reeze@php.net, PHP internals Content-Type: multipart/alternative; boundary="94eb2c07d61470797f05566d553a" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Allow default value in list() syntax From: devnuhl@gmail.com (Devnuhl Unnamed) --94eb2c07d61470797f05566d553a Content-Type: text/plain; charset="UTF-8" Would isset($suffix) not suffice here? There are several things I've thought of that would be other alternatives to changing this language construct, but as I don't have my laptop with me, some of the testing to confirm behavior will have to wait. Other concerns fall around list() already being a difficult thing for people to understand, let alone use properly. Making it look even more like a function definition would likely exacerbate this. -Chris On Aug 10, 2017 16:33, "Sara Golemon" wrote: On Thu, Aug 10, 2017 at 5:21 PM, Andreas Hennings wrote: > I found this RFC, describing a feature I wanted for a long time: > https://wiki.php.net/rfc/list_default_value > https://marc.info/?l=php-internals&m=144707619509724 > > I regularly want this kind of feature when unpacking a string with explode(): > > list($prefix, $suffix = NULL) = explode(':', $string); > if (NULL !== $suffix) { > ... > } > Agreed. This comes up for me every time I want to parse a text file (including about 30 minutes ago, as it happens). +1 -Sara --94eb2c07d61470797f05566d553a--