Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109569 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6227 invoked from network); 8 Apr 2020 15:18:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Apr 2020 15:18:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B98DC1804C2 for ; Wed, 8 Apr 2020 06:47:00 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 ; Wed, 8 Apr 2020 06:47:00 -0700 (PDT) Received: by mail-lj1-f182.google.com with SMTP id z26so3564515ljz.11 for ; Wed, 08 Apr 2020 06:47:00 -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=Y6BGpsWs3545aeAsFGkL64FnmFieL5xhnT0/RDTLPPM=; b=TApK+d3e5yh2R6f5c8bTa7rx/zqBVZiQmUJWqO93LEpwwI8kyMOwzciR4deG8h+0Q3 iOwmxwf47hGlEovm2YGoq9hfiaDwTCs70m3teCH0dpx6sU0ABVEtFAfIH+lm8NxfvJ1i LQM7VNj+o5AwaItR5igMCtJ+TB63Kxj87Sx9WZyvYtW2ZVpw/uf9iDiLM+sUeagjTBNE aNhAixsyC8MTB3goK0tPQL09KEzCtwkE8DhquvFh9cqKg0HQdcwsDYzgxnEjMxgPF9F+ ukFCn7YADJuA08SYktDfNKh4C7wJOl7NjqnFDPncWUk0kmfGS5p+nlk/SfsYsnTSQ6PV q15w== 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=Y6BGpsWs3545aeAsFGkL64FnmFieL5xhnT0/RDTLPPM=; b=ZSzsO+5dXfcWhLrhsnwqdYNQAdR+FLgCM+h43QiSWuy1PeQ4as9kwK0Bo1D5qXjAzm WT49KrO/qm6N4j65giyIk3vtR/YZ0u7+KrYDMGZ4Ev0PBKH3q3h5gTHSCLw1NdDRVZFH AmBQUw4leZHo7UyRrv7NnjISKGTYq9Z8eO63xs+yuq72OfZ3KOhIrI7RC44Qk+PHuyOP rM7Kg80Pu2Nd6DRqnQAoWluQTtgD5VYLSnMVCW06RjUxGNUSqf3QnvJSpX6fA++LSODl R6eyfyvXOhU1nx5eUQzHRaeuftNEmysX/ZI5pyUYF4xuKbXy/xY8fLmAWTRqekG3Z4Ec 9q9A== X-Gm-Message-State: AGi0Pubbs/OE/rGNb2uwB+epy0uxXf4Amly5hF5rqW98Rs+5/QwNDyB5 7A9pRRuYPXdes6Ry6npuDh66Ho5jClPfhEMMOg== X-Google-Smtp-Source: APiQypJWmlBU9YPB6u4N8AKdnjVJsr270ZBDHsFDqSfv/1rP/4XWaywk3pNFzOXRLnl8hxxZDZ70eTMctnt54g4DVxA= X-Received: by 2002:a2e:b4e7:: with SMTP id s7mr4839916ljm.184.1586353614781; Wed, 08 Apr 2020 06:46:54 -0700 (PDT) MIME-Version: 1.0 References: <5e87a7aa.1c69fb81.2e0a2.74daSMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: Date: Wed, 8 Apr 2020 15:46:44 +0200 Message-ID: To: Sherif Ramadan Cc: Andrea Faulds , PHP Internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Change var_export() array syntax touse short hand arrays From: guilliam.xavier@gmail.com (Guilliam Xavier) On Wed, Apr 8, 2020 at 3:12 PM Sherif Ramadan wrote: > > So to recap on what's been discussed so far, because I plan to bring this > to a vote next week... > > I am updating the RFC to reflect that the change will no longer break > backwards compatibility. I will be adding an flags argument with the > following 3 optional bitwise flags for var_export: > > - VAR_EXPORT_SHORT_ARRAY [Triggers short-array syntax] > - VAR_EXPORT_NO_INDEX [Discards numbered indexes in arrays (only if they > are sequential from 0)] > - VAR_EXPORT_NO_WHITESPACE [For one-liners] > > This complicates the implementation slightly, but I think it brings a > greater net-benefit. Hello, First, thank you for proposing this RFC. I have no strong opinion either way, but anyway it cannot work as is, because var_export already has a second optional parameter (bool $return = false). You could add the flags as a third optional parameter (int $options = 0), or maybe make it replace (extend) the existing one and add an extra constant, say VAR_EXPORT_RETURN = 1, so that it can be combined (although I'm not sure that changing the type from bool to int (or maybe bool|int) would be BC-compliant...) Moreover the RFC currently says that var_export([1, 2, 3]) produces ``` array(1, 2, 3) ``` but it actually produces ``` array ( 0 => 1, 1 => 2, 2 => 3, ) ``` Regards, -- Guilliam Xavier