Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99853 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56192 invoked from network); 12 Jul 2017 12:09:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jul 2017 12:09:56 -0000 Authentication-Results: pb1.pair.com header.from=krukowski.bartlomiej@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=krukowski.bartlomiej@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.169 as permitted sender) X-PHP-List-Original-Sender: krukowski.bartlomiej@gmail.com X-Host-Fingerprint: 209.85.220.169 mail-qk0-f169.google.com Received: from [209.85.220.169] ([209.85.220.169:34092] helo=mail-qk0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/05-01782-39116695 for ; Wed, 12 Jul 2017 08:09:55 -0400 Received: by mail-qk0-f169.google.com with SMTP id d78so19597060qkb.1 for ; Wed, 12 Jul 2017 05:09:55 -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=v16p+HQDsaCZUmSu0up/mQ9M2nxkhkAUNV+241bOWzM=; b=GPxeD+3T2XveGXlyedAT1BKgETEwHCfW+6x/zDIAuHp0d3suJ9UZPzoST2bO24aF8a lHPz26Bxh/kDlF1oFxw/0OEu83WTTYeunTJ+Wc+PWgFX4SpqQ+tjxok+SM9KAFLRbxnC +2yeqOwEruSfI+V9SxvBydT+Vqz7ZSSFGBJK2VANJOKQCahqJe72MMLVuNhU+ztdpzql G4+jg4J15S/mhKkcJn/QzdNMlSqZHaY9AyMQwLLAcU9QDXIeX0ruTz/vbF9m67izyyx2 SVspt2XPhmfkbyFvSGI7cyB1Dvb7CexfmfS6vtj7O5HG3xWRBfNS6bU2h5NZKvMZqpS2 DCqw== 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=v16p+HQDsaCZUmSu0up/mQ9M2nxkhkAUNV+241bOWzM=; b=BRTEL9h1F/sGd/YQ1WZNPSvl/h7EFRcv/Z0HFMQ8vymGO7rlfosnUupa7GyiC/xUy/ P1ZXxWQe1MnSVIqxieE3IpIsw5eijzE9550tTGkAGKTSIZ8IgwV/x+PRanvWew5uFlpz b2hRagrBIQTwG2T0LSA/aKD8TNwEseA6ckWgmKaUO+WSUbHo+Fw8XyyMQPc1NFX+lZ19 iSJ/2pNR+OQSx6/rbE3XvNkBJnVribPb/PdHu9w2j6104De34250butUPsoosM6W0ZZ5 EgDDQKOxuswXUtjsnKqcI0++xHm+MH6sYL+c0x5DC3DwPq60ypU0d6G0bmOB/6cRq1m9 Y6pg== X-Gm-Message-State: AIVw113EbGm8dgEVldWCuG+LAeCr227sG+qHOLI6za1q3jBuIw42aJ6y I0V1OdaHyQMYH7hM8AFmxw27zGmKVw== X-Received: by 10.237.62.58 with SMTP id l55mr6086599qtf.20.1499861393056; Wed, 12 Jul 2017 05:09:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.152.18 with HTTP; Wed, 12 Jul 2017 05:09:32 -0700 (PDT) In-Reply-To: References: Date: Wed, 12 Jul 2017 14:09:32 +0200 Message-ID: To: Marco Pivetta Cc: PHP Internals List Content-Type: multipart/alternative; boundary="001a1144de9a8ba72105541db14c" Subject: Re: [PHP-DEV] RFC proposal - unpack iterator From: krukowski.bartlomiej@gmail.com (=?UTF-8?Q?Bart=C5=82omiej_Krukowski?=) --001a1144de9a8ba72105541db14c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, Yes, this is exactly what I would like to achieve. Best regards 2017-07-12 14:06 GMT+02:00 Marco Pivetta : > On Wed, Jul 12, 2017 at 11:22 AM, Bart=C5=82omiej Krukowski < > krukowski.bartlomiej@gmail.com> wrote: > >> Hello, >> From PHP 5.6 we have possibility to add variadic functions and unpacking >> arrays via *...* >> Would be nice to extend responsibility of *...*. Sometimes in code I can >> find lines similar to the following: >> >> $result =3D array_merge(['some value'], ['some other value'], $array); >> >> >> I would like to shorten this line to the following: >> >> $result =3D ['some value', ['some other value'], ...$array]; >> >> >> And even allow to unpack more than one array: >> >> $result =3D ['some value', ['some other value'], ...$array, >> ...$secondArray]; >> >> >> Using new operator we can produce shorter and more clearable code. I wou= ld >> like to create RFC for my proposal. If you think idea can be useful, >> please >> give me an access for creating RFC. >> >> Best regards >> > > Would this allow operations such as the following one? > > $a =3D [0]; > $b =3D [1]; > $otherArrays =3D [[2,3], [4,5]]; > $mergeAll =3D [...$a, ...$b, ...[...$otherArrays]]; // [0, 1, 2, 3, 4, 5] > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > > --001a1144de9a8ba72105541db14c--