Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: parsing print_r() output with preg_match_all() Date: Thu, 14 Jan 2016 22:55:34 +0100 Lines: 94 Message-ID: <56981956.4000100@arnowelzel.de> References: <568d3dcf$0$23748$e4fe514c@news.xs4all.nl> <87r3huzevd.fsf@bsb.me.uk> <568d6f9c$0$23759$e4fe514c@news.xs4all.nl> <569363A3.6040108@arnowelzel.de> <5694313D.3060100@arnowelzel.de> <6929015.zlp62RpN2j@PointedEars.de> <569483AF.6010606@arnowelzel.de> <56956576.3040909@arnowelzel.de> <56956FF5.3050603@arnowelzel.de> <5695E316.9050809@arnowelzel.de> <56974F6B.1040705@arnowelzel.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net 83zI16FIUCueH7lIoszDAgOTa/Ye9Bh2Ip5w/5oGm0ydOjmKbC Cancel-Lock: sha1:yOBoPeyhaVHz38ohSzgsMJBVcvk= In-Reply-To: Xref: csiph.com comp.lang.php:16280 Jerry Stuckle schrieb am 2016-01-14 um 22:08: > On 1/14/2016 2:34 AM, Arno Welzel wrote: >> Jerry Stuckle schrieb am 2016-01-14 um 01:18: >> >>> On 1/13/2016 6:14 PM, Ian Collins wrote: >> [...] >>>> Given the first example on the print_r() manual page, do you think >>>> anyone who understands this: >>>> >>>> >>> $a = array ('a' => 'apple', 'b' => 'banana', >>>> 'c' => array ('x', 'y', 'z')); >>>> print_r ($a); >>>> ?> >>>> >>>> Array >>>> ( >>>> [a] => apple >>>> [b] => banana >>>> [c] => Array >>>> ( >>>> [0] => x >>>> [1] => y >>>> [2] => z >>>> ) >>>> >>>> ) >>>> >>>> would have trouble understanding this? >>>> >>>> >>> $a = array ('a' => 'apple', 'b' => 'banana', >>>> 'c' => array ('x', 'y', 'z')); >>>> echo json_encode($a,JSON_PRETTY_PRINT); >>>> ?> >>>> >>>> { >>>> "a": "apple", >>>> "b": "banana", >>>> "c": [ >>>> "x", >>>> "y", >>>> "z" >>>> ] >>>> } >>>> >>> >>> Yes. The former is much more clear. >> >> If something is "more clear" totally depends on what people are used to >> work with. In fact both textual representations are perfectly >> *readable*. On can *read* the content. >> >> If one does not have any experience with XML, even this may not be clear >> to him: >> >> >> >> >> >> >> >> >> >> >> > > If you think this is what XML has to look like, then no wonder you think > JSON is more readable. But it also goes to show that you do NOT > understand XML. I don't say XML has to look like this - but there is no more information available. Feel free to show a better "readable" example which represents the *same* information and not introducing additional information which wasn't their before. > I suggest you learn how to write good XML before making a fool of > yourself (again), troll. I suggest you show some of your knowledge instead of accusing everone else of not knowing what they talk about. I alread did show something, Ian as well - now it's your turn. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de