Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101889 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28545 invoked from network); 20 Feb 2018 09:46:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2018 09:46:03 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Received: from [82.113.146.227] ([82.113.146.227:52226] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 89/44-22623-95EEB8A5 for ; Tue, 20 Feb 2018 04:46:02 -0500 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 2FD1A10D32C; Tue, 20 Feb 2018 09:45:59 +0000 (GMT) Date: Tue, 20 Feb 2018 09:45:58 +0000 (GMT) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: Andreas Hennings cc: David Rodrigues , PHP Internals In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1517212248-1519119959=:19303" Subject: Re: [PHP-DEV] var_export() array format From: derick@php.net (Derick Rethans) --8323329-1517212248-1519119959=:19303 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 18 Feb 2018, Andreas Hennings wrote: > On 18 February 2018 at 02:04, David Rodrigues wr= ote: > > I just think that is not responsability of PHP to care about output for= mat > > at core level (although we have the json pretty output support...). >=20 > Why not? > E.g. JSON_PRETTY_PRINT is something I use a lot, often in situations > where I don't or cannot use a 3rd party package. > E.g. > - if I abuse 3v4l.org as a php console > - in a one-off single-file cli script > - in a debugging session, or any temporary code. > - if my involvement with the project is not deep enough to justify > adding a dependency >=20 > > > > Maybe you can found some solution with packages. >=20 > See the last section of my initial message: > >> > >> Why not a userland implementation? > >> E.g. https://packagist.org/packages/riimu/kit-phpencoder > >> > >> var_export() is often used in experimental code or when just playing > >> around, situations where developers usually prefer to avoid adding a > >> 3rd party dependency. > >> Also there is no way to add a 3rd party dependency on e.g. 3v4l.org. > >> And a custom one-off implementation is not what developers should > >> spend their time on (although I did it a few times already). >=20 > If we already have a native function that generates PHP code, then we > should expect it to produce usable output.. It is already useable. From the documentation: var_export =E2=80=94 Outputs or returns a parsable string representation of= a variable If you want to be able to control the formatting, that's just best done=20 in a userland package. cheers, Derick --=20 https://derickrethans.nl | https://xdebug.org | https://dram.io Like Xdebug? Consider a donation: https://xdebug.org/donate.php, or become my Patron: https://www.patreon.com/derickr twitter: @derickr and @xdebug --8323329-1517212248-1519119959=:19303--