Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112983 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48368 invoked from network); 25 Jan 2021 14:51:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Jan 2021 14:51:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6A76C1804CF for ; Mon, 25 Jan 2021 06:32:34 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12olkn2070.outbound.protection.outlook.com [40.92.22.70]) (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 ; Mon, 25 Jan 2021 06:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OPLXJtxpHxQ/3R21LZ9O76vZ5izLy7Di8IOCA8ze4yyFqebDmNGfeovxfLWp6twb7FIHSUA09OJc1J2ffpSnvEteU1h6vp1kXdplXNrrSUyApBIvwzyDKWtHYEOjBZLoKofNbgujceYl7LjDoq9U55Fwivr87fNA7Ixe7RY7ne55qfqwqbeKyYWCqJn6lFKBGkDJPcJ/QALzYNh5MKgtIORILmHloOnDOuQZbL9jo/3w6yUDUr+eO8liouSD/ypbq+HQxZiUpP509RmqTykRLk0fD/e8RIq7KOSrQbJYTCjnsnI/gFKzEE+5g2Wf+UgW3gNVP4WqE9nYEq+3KPx4aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sq289ki2700SS0CJfVkSaWJIeDtpSXI3Db9pRgyVNUU=; b=gXtzoagwkDx/GI0Dqt6JR1g2ZU0lHeC8e1LzmA1V4BS5fBweZN4jvUmn0foacaFMI5ywxnSekq3xUg1uLSyrkhMDEuLwXx53jloisJgswQVIGnh8PYRPJTd3REqv6Th6ofO6hk/CkAp9mUapDG2nkct+HMeGtb0OuRiiXGaUOxlWqWxZXkJi787mjBX12wzTqkx01Xcr5Sp24DLaJyZAgrtTAU31bg2qr/uDORh1aVnI/oLJIJO9kJ5qWrCZzjZAY47w4u8feglLH1wL4Wy89DR9WztX1ilvzD6kHBWfVyN3y+RqlZac9c4FKSDviMcVfFSosHvPmaKmpUEepFMGAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sq289ki2700SS0CJfVkSaWJIeDtpSXI3Db9pRgyVNUU=; b=mtHaX50MlVDm6gteDfku8LaoTltg4ushzs/uyE3DJdgTXDu9o5gs6M6kHh+8g6YhlyVbSxq0jXalOJYPveXAsBxQk/2f8e5H/MUNmIBwjVAs4MQc+AI2B4SM1Ztov5/jfvlZPrDUCZIxIiaGs1Pi3Lc7EtapQMVM7lCR5zB1VR+LwnY0gg0EDscL61MTNlIIFvBpo0scCuTt95epYgIJChEgcAuRPz7eEzYgo+GI1Y4uAB9b3H1Fo9DgBOye9fHmT0pPO3QIeAxXHUevwtqymJ+424MAbqPXM+HR5r08KixctPqux9ozQBhVDRbmJAMNtJuXJdE4ROmXuR88rlcp1A== Received: from DM6NAM12FT033.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::4b) by DM6NAM12HT109.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6; Mon, 25 Jan 2021 14:32:32 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:fc64::47) by DM6NAM12FT033.mail.protection.outlook.com (2a01:111:e400:fc64::270) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6 via Frontend Transport; Mon, 25 Jan 2021 14:32:32 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d%4]) with mapi id 15.20.3784.017; Mon, 25 Jan 2021 14:32:32 +0000 To: Dusk , Rowan Tommins CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] var_representation() : readable alternative to var_export() Thread-Index: AQHW8R1wWWGP+37l0kiexDpDbUAmVKo1egmAgAAyURKAAR7sgIAAs3OAgAAAtPg= Date: Mon, 25 Jan 2021 14:32:32 +0000 Message-ID: References: <5ae166a8-378e-b3bc-056a-8ccf4f3a1ddd@gmail.com> ,<8A960D21-CA74-436F-97FF-B8D76E6D8703@woofle.net> In-Reply-To: <8A960D21-CA74-436F-97FF-B8D76E6D8703@woofle.net> Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:7B6A41645BF6277D75750FE16A4701741768232149D653BE4B1540F4A9A35DCC;UpperCasedChecksum:6691B965804EF52B2899F6CEA5186E3B19725ECEDEAA1E52721F063B81557740;SizeAsReceived:7415;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [qw30f8fUous61H/u272/PcYCkgNHojuBMAyXnnKp0Ne2K4gsKj4MXKkVMblKbUFQ] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 0fc26b0d-a3e1-409a-9fa8-08d8c13e0d33 x-ms-traffictypediagnostic: DM6NAM12HT109: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1m4sg511Y7OJH3d/bYg1odWQkAKodJLOE654yPMLpLo3Qteo23Ctp/AEVg+4/2iMsaTkb2E9PavJPOBqdSIPc0wHZc33GUltyVu175SMOWMmNPmUAhsPH37FXjxa5t6qG9BUt57n+4J6OfnGqlrVBPWaFEw0deGkYsgRRMg4SXwdcntKaQbpcSU5JSYdwbx9TEojf5ugCBXfyvaPWYMrotTLZvQnZ3f8vrPAY6+7RPdr+sGIL6hCL3CSoDfmZKD6 x-ms-exchange-antispam-messagedata: 23KsWziBLEF/4BxKLqcKyObg2pATUxsYC6EERPg/B2IzG1DXApzUqgKznZcmvybeZbi2z5yOX+DMg6sZgrdKcSWsVzOQV45oUUlb/1BXCdwu75rWjdFLnTXGODBbhv4d/GlrabRCvt1y6xSYSrXU/sM0fGLlOJSMy4XnWsqnfUXF94ejUdSTlP4hqWs9kGZMyDNUJ3TkNBcKCZSSUAyHFw== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: DM6NAM12FT033.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 0fc26b0d-a3e1-409a-9fa8-08d8c13e0d33 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jan 2021 14:32:32.5206 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM12HT109 Subject: Re: [PHP-DEV] [RFC] var_representation() : readable alternative to var_export() From: tysonandre775@hotmail.com (tyson andre) Hi Dusk,=0A= =0A= > There's an interesting edge case where this does become useful. If an eva= luable representation of a data structure is written to a file (wrapped wit= h ` =0A= > What'd be particularly useful for this use case would be a function which= behaved similarly to `var_export()`, but which didn't pretty-print its out= put, so as to yield a smaller file.=0A= =0A= The larger benefit is readability and that you could reindent the output or= change the line endings in the output (automatically or manually through y= our IDE) without worrying about accidentally changing the representation.= =0A= =0A= ```=0A= // or other classes=0A= const SER =3D array (=0A= 0 =3D> 'O:8:"stdClass":1:{s:7:"headers";s:20:"Content-Length: 10=0A= ";}',=0A= );=0A= ```=0A= =0A= The size on disk would be smaller and I expect the encoding and saving a fi= le to disk could be a tiny bit faster,=0A= but the size in opcache would be unchanged because the resulting array is t= he same.=0A= For the question of size, you'd still benefit in cases where representation= size (e.g. megabytes of large/nested configuration or generated data) is a= concern=0A= and may or may not get a small speedup when loading the file for the first = time after clearing opcache (e.g. server restart).=0A= (haven't benchmarked it)=0A= =0A= Cheers,=0A= - Tyson=