Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109307 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76523 invoked from network); 25 Mar 2020 20:22:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Mar 2020 20:22:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 06C461804F2 for ; Wed, 25 Mar 2020 11:47:07 -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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS2639 136.143.188.0/24 X-Spam-Virus: No X-Envelope-From: Received: from sender4-op-o11.zoho.com (sender4-op-o11.zoho.com [136.143.188.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 25 Mar 2020 11:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585162023; cv=none; d=zohomail.com; s=zohoarc; b=ntA6OgsSlVrMyldJQOXi3HRYZ+xiT90GRC5WMqSeBf2mxJIw8hGHZwXSyZ6Pw2S9aW1Y7bOdWrOp108WSoXJwDhStPIye2mYkgvloTQicTsA/tFFsHpBgsJSPM4zwG47GqQsSI9eH+SY8SZcr0AJPrVhu5RnXvnXZGeeMANtlnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585162023; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=X6gYpJcIGtiafqvWr+L6DyBky2JjknzxEwH8ybE0na4=; b=V5OSqOnCiW8f8gM7I5/k9h42ofPX5fxRmEFyKptfR9L2i2KIazCqbZdzK4WgkMVfZ5arIxoX7E0vtp52b+7+teGNJpKpFhMAqH+3gLDKKTwmNd5TiPPPibGVJYZz5DWPJgFzp5/O5HzgvUhKo68TCeBQuQOg2srV0gh5Mst+E2Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=manuelcanga.dev; spf=pass smtp.mailfrom=php@manuelcanga.dev; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1585162023; s=zoho; d=manuelcanga.dev; i=php@manuelcanga.dev; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=X6gYpJcIGtiafqvWr+L6DyBky2JjknzxEwH8ybE0na4=; b=TQGen2Yjs6ne4mmNHI8iWgMLWPfQQjLzqVy1kJH4fbCbnyvsDTvgPIqxjZEVEwtd fVqtU/2bPpz2EOPHI2rGpEIvurrtBVycdN7cBbYM6QMbLOS5hoWYNAMsvKSXmY49i0z kbJUVHPSt+XFUMXIlCfvYdLK0Oz9q0prGfL+/yUQ= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1585161991195752.6860695273903; Wed, 25 Mar 2020 11:46:31 -0700 (PDT) Date: Wed, 25 Mar 2020 19:46:31 +0100 To: "Enno Woortmann" Cc: "internals" Message-ID: <171130405bb.bccba61e53890.4015147774418272523@manuelcanga.dev> In-Reply-To: <59e48d22-6d2d-19df-1b4a-cb2e7281ceea@web.de> References: <59e48d22-6d2d-19df-1b4a-cb2e7281ceea@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Type casting in array destructuring expressions From: php@manuelcanga.dev (Manuel Canga) Hi, Enno, ---- En mi=C3=A9, 25 mar 2020 18:53:15 +0100 Enno Woortmann escribi=C3=B3 ---- > Hi, >=20 > I've written the RFC and implemented a first patch concerning the idea > to allow type casting in array destructuring expressions. >=20 >=20 > The RFC is located at https://wiki.php.net/rfc/typecast_array_desctructu= ring >=20 > The patch can be found in MR 5296 located at > https://github.com/php/php-src/pull/5296 >=20 >=20 > Thanks for further feedback! >=20 > Cheers, Enno >=20 I like your RFC. I hope it is approved. However, I would change your exam= ples. Because, this one: ["now" =3D> (int) $now, "future" =3D> (int) $future] =3D ["now" =3D> "2020"= , "name" =3D> "2021"]; You could do casting in this way: ["now" =3D> $now, "future" =3D> $future] =3D array_map('intval', ["now" =3D= > "2020", "name" =3D> "2021"] ); If I were you I add examples with mixed types, like: ["address" =3D> (string) $address, "floor" =3D> (int) $floor] =3D ["address= " =3D> "My adress", "floor" =3D> "3"]; I'm sorry my English Regards -- Manuel Canga