Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51348 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16738 invoked from network); 24 Jan 2011 19:21:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jan 2011 19:21:02 -0000 Authentication-Results: pb1.pair.com header.from=dmgx.michael@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=dmgx.michael@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dmgx.michael@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-wy0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:44901] helo=mail-wy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/D1-07901-D11DD3D4 for ; Mon, 24 Jan 2011 14:21:02 -0500 Received: by wyb39 with SMTP id 39so4384576wyb.29 for ; Mon, 24 Jan 2011 11:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=jVSGmIP/fhPpP5+lK43K24VwU9H1dABpbQcFsGyGfY0=; b=xF0bj3zhiS0aF9VMOz9rOHLfy/Vw0XDC6iw7oRnA1d+hMXBrhwQFybQOcUWfYu7Jp7 4Gg/lalelMVMgxyzCJ9o4KosVuwwJzacI7WIra6OXm/Dw36KrILQn8r7Kba0J5Qf3m1u Vn2fINEYfJc3aBBzGAu5KxOHdNmy42Nh4VmYI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ML6gS664rfpMtLP9ej8YEl38nPLKlMXu0sAN2eQB9+CjetiwYZ6p2iECmpeolJ8Kf/ 1oAM65dpJqh7MMrQLxqpVtHbkKHrUz86GPhuoC2uFchWI3ttnT2sIUKGbEj4gMxhEgp6 bFCq1yL54IJvA58+xu6pSJ+NnsNgmEwkMAUKY= MIME-Version: 1.0 Received: by 10.216.241.66 with SMTP id f44mr3939515wer.70.1295896858127; Mon, 24 Jan 2011 11:20:58 -0800 (PST) Received: by 10.216.45.148 with HTTP; Mon, 24 Jan 2011 11:20:58 -0800 (PST) In-Reply-To: References: Date: Mon, 24 Jan 2011 14:20:58 -0500 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary=e0cb4e43d2d3e4edaa049a9c7f56 Subject: Re: [PHP-DEV] [RFC] Var_export tabbing From: dmgx.michael@gmail.com (Michael Morris) --e0cb4e43d2d3e4edaa049a9c7f56 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable That is the primary purpose. For most datasets str_replace(' ', "\t", var_export($obj, true)) gets what I want. But this is for exploration of process. I don't expect it to be committed to the language on a permanent basis. To be honest, it would be better as a php.ini setting - export_indentation. The default value would be ' ' and PHP would fall to that value if it isn't set. And I'll likely do that as a step two learning thing. Changing how includes work was my first suggestion and what I'd like to wor= k on, but that has to come after more elementary things. On Mon, Jan 24, 2011 at 2:13 PM, Hannes Landeholm wrot= e: > If you're looking into doing something that are both useful and good for > learning C, my suggestion is to hack PHP in some way that makes something > possible (in PHP) that you couldn't simply accomplish by writing a simple > wrapper function or workaround. Making var_export use tabs instead of > spaces > is easily accomplished by wrapping it in another function that > preg_replaces > starting line spaces with tabs. > > Reading your suggestion, I almost get the feeling that you believe the on= ly > reason var_dump doesn't have more arguments (or does this yet) is because > nobody thought about it or had time changing it. Changing built in php > functions is not A Good Thing=99 in general. Functions should serve a > specific > purpose, not have a gazillion arbitrary arguments for every possible use > case. > > For just the purpose of just learning C however, go ahead. Sounds like a > good start. > > Hannes > > On 24 January 2011 19:26, Michael Morris wrote: > > > I've been trying to think of something that would be a good project to > cut > > my teeth on for a first C project in forever and I'd rather work on > > something that might be useful. While cleaning tabbing on a var_export > for > > a test class I think I have an idea. > > > > What I'm looking for is two things. One, is this the sort of thing that= a > > beginner to C (not a beginning programmer mind you - I've been doing PH= P > > scripting for, gosh, 7 years now) can do. If so I'll do this just for > the > > experience of it because I need to learn how to prep patches and the > > remainder of the process for more major patches - such as the include > style > > I RFC'ed earlier. It looks like if it's going to happen I'll have to > learn > > how to do it. > > > > Anyway, var_export takes 2 arguments - the expression to be converted a= nd > > whether to return or echo it. I'd like to add a third, whether to use > > spaces (default) or tabs for indentation > > > > For backwards compatibility null would mean uses spaces, and use 2 per > > indentation. If set to true a tab character would be used. > > > > Thoughts and input appreciated. > > > --e0cb4e43d2d3e4edaa049a9c7f56--