Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106677 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38039 invoked from network); 20 Aug 2019 22:31:38 -0000 Received: from unknown (HELO mail-qk1-f170.google.com) (209.85.222.170) by pb1.pair.com with SMTP; 20 Aug 2019 22:31:38 -0000 Received: by mail-qk1-f170.google.com with SMTP id g17so5594039qkk.8 for ; Tue, 20 Aug 2019 13:01:51 -0700 (PDT) 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=82VCLqXLDTVj8wUIwW6VEBcYvMlocJ29nkTtAbRp81I=; b=UbB6UGlc8XG5A2LGxTpxcy57Bg0gBY4SUefPKvnn1mW7Mn1y27trqKHlm2OMFH2brO bKOqne2lSlouWF+rR9s4K52npe+dIGgV4jlD2X1qogn+SGIfL4P1qTTReqtDDE/GZfYH FgsRP0NmHoZOTo+p/iPRXdcZJx1pxpFu+wVK4fTf9G+sL1Ys2tTGrkIAuEGI9yf4+pm8 Pthk77LJoRp4s6Tdbfj5e7XjQ9AoPkbFslNAPhdZJOKarSOmHa2jEFvtbY76BwCWYgcS Z/w7s3/cMzhJ8DRALmqEDhm0ibheOz/7prrQkTwnzb6u+6kkNUZoRti59fshYnx7ueUI qdPg== X-Gm-Message-State: APjAAAWCN4X7RDXCxQk0sS7fSMl+Frus6NdS7zAIdG+1yoUEFA9soAy3 XZ3XQtT4lUd2XEW36q+xNxmGYmOFeXvAm6n2y+0x7Q== X-Google-Smtp-Source: APXvYqyuQZWo3qRdCrPj1ZhrK+QISg0LEsN5auq82+na3a46XprO2QHbA1fDrIamhXixkTsIP85NXYsD+neVtRxcPEw= X-Received: by 2002:a37:9802:: with SMTP id a2mr27726003qke.346.1566331311359; Tue, 20 Aug 2019 13:01:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 20 Aug 2019 15:01:39 -0500 Message-ID: To: =?UTF-8?B?0JLQu9Cw0LQg0JzQsNC60LjQvQ==?= Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000006a18bf059091edbd" Subject: Re: [PHP-DEV] RFC: var_export - short syntax for array From: pollita@php.net (Sara Golemon) --0000000000006a18bf059091edbd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Aug 20, 2019 at 1:05 PM =D0=92=D0=BB=D0=B0=D0=B4 =D0=9C=D0=B0=D0=BA= =D0=B8=D0=BD wrote: > I would like to propose a little change in var_export function behavior. > For today, this function returns string representation of array in old > style with =E2=80=9Carray=E2=80=9D keyword: > > var_export([]); // array() > > I think it would be better if the function returned array representation = in > modern square brackets syntax: > > var_export([]); // [] > > I do like the idea of doing this, and would even be generally okay with just making always work that way since the introduction of square bracket syntax is really *quite* old. The only people I could see being bothered by the change in output would be automated code-generation suddenly seeing a (potentially quite massive) diff as the bracket style changes. As an example, https://github.com/php/web-php/blob/master/include/releases.inc is a 10k line var_export() generated list. I'm actually /not/ bothered by the idea of having a big point-in-time flip of that structure, though I'd want to make sure all RMs switch versions at the same time, otherwise it could get noisy. Perhaps an option to quell any dissent might be to add a third param $options to allow controlling this behavior. function var_export(mixed $data, bool $return =3D false, int $options =3D 0= ): string {} And you could either pass EXPORT_SHORT_ARRAY or EXPORT_LONG_ARRAY or whatever you want to call the constants depending on which behavior you'd make default (and honestly, I think we'd make the existing format default). -Sara --0000000000006a18bf059091edbd--