Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #16110 > unrolled thread
| Started by | "R.Wieser" <address@not.available> |
|---|---|
| First post | 2016-01-06 17:18 +0100 |
| Last post | 2016-01-12 16:11 +0100 |
| Articles | 20 on this page of 114 — 10 participants |
Back to article view | Back to comp.lang.php
parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-06 17:18 +0100
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-06 19:28 +0000
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-06 20:50 +0100
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-06 21:12 +0000
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-06 16:20 -0500
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-07 02:23 +0000
Re: parsing print_r() output with preg_match_all() Matthew Carter <m@ahungry.com> - 2016-01-06 21:48 -0500
Re: parsing print_r() output with preg_match_all() Matthew Carter <m@ahungry.com> - 2016-01-06 21:52 -0500
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 10:20 +0100
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-07 10:56 +0000
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 12:55 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-07 08:36 -0500
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-07 13:58 +0000
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 15:33 +0100
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-07 15:31 +0000
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 18:23 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-06 22:50 -0500
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 10:10 +0100
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 10:03 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-07 08:38 -0500
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-07 14:05 +0000
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-07 13:42 -0500
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-07 20:24 +0000
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-07 15:27 -0500
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 09:51 +0100
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-07 11:18 +0000
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 14:00 +0100
Re: parsing print_r() output with preg_match_all() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-07 14:00 +0000
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 16:19 +0100
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-11 09:11 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-11 08:04 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-11 23:48 +0100
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-12 00:41 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-11 20:53 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-12 05:40 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-12 09:12 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-12 21:43 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-12 16:12 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-12 22:28 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-12 16:35 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-13 06:39 +0100
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-13 08:26 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-13 08:10 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-13 14:49 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-13 10:08 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-13 18:50 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-13 15:06 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-13 23:11 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-13 17:18 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-13 23:27 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-13 19:17 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-14 01:30 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-13 20:52 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-14 08:13 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-14 09:18 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-14 20:07 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-14 16:06 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-14 22:41 +0100
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-14 22:35 +0100
Re: parsing print_r() output with preg_match_all() Ian Collins <ian-news@hotmail.com> - 2016-01-14 10:24 +1300
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-13 17:20 -0500
Re: parsing print_r() output with preg_match_all() Ian Collins <ian-news@hotmail.com> - 2016-01-14 12:14 +1300
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-13 19:18 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-14 08:34 +0100
Re: parsing print_r() output with preg_match_all() Anders Wegge Keller <wegge@geostat.dk> - 2016-01-14 09:20 +0100
Re: parsing print_r() output with preg_match_all() Ian Collins <ian-news@hotmail.com> - 2016-01-14 21:56 +1300
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-14 16:08 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-14 22:55 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-14 16:59 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-14 23:09 +0100
Re: parsing print_r() output with preg_match_all() Ian Collins <ian-news@hotmail.com> - 2016-01-15 11:17 +1300
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-14 19:15 -0500
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-14 19:14 -0500
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-11 20:50 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-12 05:42 +0100
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-12 08:41 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-12 09:13 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-12 21:44 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-12 16:13 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-12 22:29 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-12 16:33 -0500
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-12 00:49 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-11 20:54 -0500
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 11:17 +0100
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 13:49 +0100
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 14:20 +0100
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 15:31 +0100
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 16:00 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-07 13:45 -0500
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-07 20:18 +0100
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 20:52 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-07 15:29 -0500
Re: parsing print_r() output with preg_match_all() Tim Streater <timstreater@greenbee.net> - 2016-01-07 22:42 +0000
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-08 10:43 +0100
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-11 09:07 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-11 08:05 -0500
Re: parsing print_r() output with preg_match_all() Arno Welzel <usenet@arnowelzel.de> - 2016-01-11 23:51 +0100
Re: parsing print_r() output with preg_match_all() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-12 00:31 +0100
Re: parsing print_r() output with preg_match_all() Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-11 20:55 -0500
Re: parsing print_r() output with preg_match_all() "R.Wieser" <address@not.available> - 2016-01-12 11:11 +0100
Re: parsing print_r() output with preg_match_all() - question remains unanswered ... "R.Wieser" <address@not.available> - 2016-01-12 11:54 +0100
Re: parsing print_r() output with preg_match_all() - question remains unanswered ... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-12 11:25 +0000
Re: parsing print_r() output with preg_match_all() - question remains unanswered ... "R.Wieser" <address@not.available> - 2016-01-12 13:41 +0100
Re: parsing print_r() output with preg_match_all() - question remains unanswered ... "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-01-12 14:11 +0100
Re: parsing print_r() output with preg_match_all() - question remainsunanswered ... "R.Wieser" <address@not.available> - 2016-01-12 14:34 +0100
Re: parsing print_r() output with preg_match_all() - question remainsunanswered ... "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-01-12 15:03 +0100
Re: parsing print_r() output with preg_match_all() - questionremainsunanswered ... "R.Wieser" <address@not.available> - 2016-01-12 15:50 +0100
Re: parsing print_r() output with preg_match_all() - questionremainsunanswered ... "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-01-12 16:36 +0100
Re: parsing print_r() output with preg_match_all() - Solved. "R.Wieser" <address@not.available> - 2016-01-12 21:28 +0100
Re: parsing print_r() output with preg_match_all() - question remains unanswered ... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-12 14:02 +0000
Re: parsing print_r() output with preg_match_all() - question remains unanswered ... "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-01-12 12:42 +0100
Re: parsing print_r() output with preg_match_all() - question remainsunanswered ... "R.Wieser" <address@not.available> - 2016-01-12 14:20 +0100
Re: parsing print_r() output with preg_match_all() - question remains unanswered ... Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-12 09:43 -0500
Re: parsing print_r() output with preg_match_all() - question remainsunanswered ... "R.Wieser" <address@not.available> - 2016-01-12 16:11 +0100
Page 5 of 6 — ← Prev page 1 2 3 4 [5] 6 Next page →
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-01-12 16:33 -0500 |
| Message-ID | <n73r9s$goq$1@jstuckle.eternal-september.org> |
| In reply to | #16229 |
On 1/12/2016 4:29 PM, Arno Welzel wrote: > Jerry Stuckle schrieb am 2016-01-12 um 22:13: >> On 1/12/2016 3:44 PM, Arno Welzel wrote: >>> Jerry Stuckle schrieb am 2016-01-12 um 15:13: >>> >>>> On 1/11/2016 11:42 PM, Arno Welzel wrote: >>>>> Jerry Stuckle schrieb am 2016-01-12 um 02:50: >>>>> >>>>>> On 1/11/2016 5:48 PM, Arno Welzel wrote: >>>>>>> Jerry Stuckle schrieb am 2016-01-11 um 14:04: >>>>>>>> On 1/11/2016 3:11 AM, Arno Welzel wrote: >>>>>>>>> R.Wieser schrieb am 2016-01-06 um 20:50: >>>>>>>>> >>>>>>>>>> Ben, >>>>>>>>>> >>>>>>>>>>> It would be a lot simpler if you could switch to using >>>>>>>>>>> serialize and unserialize. Do you need to use print_r >>>>>>>>>>> for some other reason? >>>>>>>>>> >>>>>>>>>> I'm using it to store the array-of-arrays into a file in human-readable >>>>>>>>>> format. I intend to parse this file using another program, posibly alter >>>>>>>>>> some info and write it back. >>>>>>>>>> >>>>>>>>>> And thats the point where I wanted to use that regex to read the structure >>>>>>>>>> back in. >>>>>>>>>> >>>>>>>>>> Now you mention it, I've heard from serializing and unserializing, but >>>>>>>>>> was/am assuming that its not really ment to be read/understood by humans. >>>>>>>>>> >>>>>>>>>> But what's the problem with using that preg_match_all() ? >>>>>>>>> >>>>>>>>> It's prone to errors to build a parser on your own and there are already >>>>>>>>> working and tested(!) solutions. >>>>>>>>> >>>>>>>>> May JSON is a good alternative for you: >>>>>>>>> >>>>>>>>> <http://php.net/manual/en/function.json-encode.php> >>>>>>>>> <http://php.net/manual/en/function.json-decode.php> >>>>>>>>> >>>>>>>>> JSON is still "human readable" but also a defined format and there are >>>>>>>>> parsers for other programming languages as well. >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> Gee, who built the parsers we have? Machines? ROFLMAO! >>>>>>> >>>>>>> No - but there are *standards* you can refer to which are usually way >>>>>>> better then trying to invent the wheel over and over again. >>>>>>> >>>>>> >>>>>> You wouldn't know. You have no idea what standards are. >>>>> >>>>> What you call ECMA then? An organization of trolls? >>>>> >>>>> >>>> >>>> I know what ECMA is. But you have no idea what standards are, troll. >>> >>> >>> You did it again. QED. >>> >> >> Trying to put words in my mouth again I see, troll. It doesn't work - >> it just makes you look even more stoopid. > > You did it again. QED. > > Oh - and you will repeat this many, many times and will never believe > that your behaviour is inappropriate. > > Not at all, troll. You just continue to make a fool of yourself. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2016-01-12 00:49 +0100 |
| Message-ID | <2976485.l7SP3Tcp0v@PointedEars.de> |
| In reply to | #16171 |
Arno Welzel wrote:
> R.Wieser schrieb am 2016-01-06 um 20:50:
>>> It would be a lot simpler if you could switch to using
>>> serialize and unserialize. Do you need to use print_r
>>> for some other reason?
>>
>> I'm using it to store the array-of-arrays into a file in human-readable
>> format. I intend to parse this file using another program, posibly alter
>> some info and write it back.
>>
>> And thats the point where I wanted to use that regex to read the
>> structure back in.
>>
>> Now you mention it, I've heard from serializing and unserializing, but
>> was/am assuming that its not really ment to be read/understood by humans.
>>
>> But what's the problem with using that preg_match_all() ?
>
> It's prone to errors to build a parser on your own and there are already
> working and tested(!) solutions.
You have avoided the answer to the question. As I indicated, the problem
with preg_match_all() is that it is unsuitable to the task. Regular
expressions are not suited to parse bracket languages, which are not
regular. PCRE has recursion, but that is limited. And with
preg_match_all() you would have to use alternation where the first match,
not the longest one, would win.
$ php -r 'preg_match_all("/foo|foobar/", "foobar", $matches);
print_r($matches);'
Array
(
[0] => Array
(
[0] => foo
)
)
--
PointedEars
Zend Certified PHP Engineer
<http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-01-11 20:54 -0500 |
| Message-ID | <n71m7i$tv4$2@jstuckle.eternal-september.org> |
| In reply to | #16188 |
On 1/11/2016 6:49 PM, Thomas 'Pointed Head' Lahn wrote:
> Arno Welzel wrote:
>
>> R.Wieser schrieb am 2016-01-06 um 20:50:
>>>> It would be a lot simpler if you could switch to using
>>>> serialize and unserialize. Do you need to use print_r
>>>> for some other reason?
>>>
>>> I'm using it to store the array-of-arrays into a file in human-readable
>>> format. I intend to parse this file using another program, posibly alter
>>> some info and write it back.
>>>
>>> And thats the point where I wanted to use that regex to read the
>>> structure back in.
>>>
>>> Now you mention it, I've heard from serializing and unserializing, but
>>> was/am assuming that its not really ment to be read/understood by humans.
>>>
>>> But what's the problem with using that preg_match_all() ?
>>
>> It's prone to errors to build a parser on your own and there are already
>> working and tested(!) solutions.
>
> You have avoided the answer to the question. As I indicated, the problem
> with preg_match_all() is that it is unsuitable to the task. Regular
> expressions are not suited to parse bracket languages, which are not
> regular. PCRE has recursion, but that is limited. And with
> preg_match_all() you would have to use alternation where the first match,
> not the longest one, would win.
>
> $ php -r 'preg_match_all("/foo|foobar/", "foobar", $matches);
> print_r($matches);'
> Array
> (
> [0] => Array
> (
> [0] => foo
> )
>
> )
>
Which still does not solve the *real* problem.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2016-01-07 11:17 +0100 |
| Message-ID | <1918095.oM0jGXUH9t@PointedEars.de> |
| In reply to | #16110 |
R.Wieser wrote:
^^
Please post here using your first name, too.
> I'm saving the contents of an array-of-arrays into a string with
> print_r(). Now I want to parse the contents of that string into an
> array-of-arrays again.
You should not do that.
> I've found some code which is supposed to do that (at
> http://nl3.php.net/print_r), but it seems to depend on TAB chars being
> present in the output -- and those do not appear in mine.
>
> So, I tried to alter the used regexp to the preg_match_all() function,
> which is where all the fun started: I cannot seem to find a notation which
> will just add the detection of a closing bracket (ending a sub-array).
>
> Can anyone here lend me a hand ?
>
> The offending line :
>
> if (preg_match_all('/^\s+\[(\w+).*\] => (.*)\n/m', $printr, $match)) {
In computer linguistics, the branch of computer science dealing with formal
languages, the formal grammar that can produce the output of print_r() in
this case is context-free (Chomsky type-2), and the languages that can be
produced by such a grammar are context-free languages.
Therefore, it is in general not possible to parse such languages with one
application of one *regular* expression, because *regular* expressions are a
tool to describe *regular* languages (Chomsky type-3); IOW, a regular
expression will in general either match too much when greedy (default) or
too little when non-greedy. The relation is thus: All regular languages are
context-free, but not all context-free languages are regular.
The nested, paired parentheses in the print_r() output show that the
print_r() output language cannot be regular: the language of well-
formed/balanced parentheses/brackets (bracket language) is the textbook
example of a context-free language that is not regular, which can be shown
by application of the pumping lemma for regular languages.
PHP supports Perl-Compatible Regular Expressions which provide the “(?R…)”
feature to match text recursively. This makes it possible to match nested
balanced parentheses to a certain degree (as far as stack memory permits).
However, to be on the safe side you would need to write a parser for this
language (which would basically be an implementation of a deterministic
push-down automaton, but can use regular expressions; but depending on the
programming language that is not necessarily the most efficient approach –
in PHP, where regular expressions are not objects, it probably is not).
But it is easier to use existing parsers for other formats. For example,
since you say in <news:568d6f9c$0$23759$e4fe514c@news.xs4all.nl> that you
need human-readable output (which excludes the built-in serialization
mechanism to binary), you should look into JSON which PHP supports with an
extension. Other alternatives that come to mind are CSON, YAML, and XML (in
that order, with increasing overhead). PHP also has built-in XML support,
and there is a PECL extension for YAML (not bundled with PHP).
<https://en.wikipedia.org/wiki/Chomsky_hierarchy>
<http://php.net/manual/en/regexp.reference.recursive.php>
<http://php.net/json>
<http://php.net/xml>
<http://php.net/yaml>
--
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-01-07 13:49 +0100 |
| Message-ID | <568e60e3$0$23768$e4fe514c@news.xs4all.nl> |
| In reply to | #16131 |
Thomas,
Thanks for your opinions. But as your post does not actually contain
anything constructive -- much less an attempt to answer my question -- I
can't do much, if anything with it.
Regards,
Rudy Wieser <-- Blimy! There it is ! My first name! :-)
-- Origional message:
Thomas 'PointedEars' Lahn <PointedEars@web.de> schreef in berichtnieuws
1918095.oM0jGXUH9t@PointedEars.de...
> R.Wieser wrote:
> ^^
> Please post here using your first name, too.
>
> > I'm saving the contents of an array-of-arrays into a string with
> > print_r(). Now I want to parse the contents of that string into an
> > array-of-arrays again.
>
> You should not do that.
>
> > I've found some code which is supposed to do that (at
> > http://nl3.php.net/print_r), but it seems to depend on TAB chars being
> > present in the output -- and those do not appear in mine.
> >
> > So, I tried to alter the used regexp to the preg_match_all() function,
> > which is where all the fun started: I cannot seem to find a notation
which
> > will just add the detection of a closing bracket (ending a sub-array).
> >
> > Can anyone here lend me a hand ?
> >
> > The offending line :
> >
> > if (preg_match_all('/^\s+\[(\w+).*\] => (.*)\n/m', $printr, $match)) {
>
> In computer linguistics, the branch of computer science dealing with
formal
> languages, the formal grammar that can produce the output of print_r() in
> this case is context-free (Chomsky type-2), and the languages that can be
> produced by such a grammar are context-free languages.
>
> Therefore, it is in general not possible to parse such languages with one
> application of one *regular* expression, because *regular* expressions are
a
> tool to describe *regular* languages (Chomsky type-3); IOW, a regular
> expression will in general either match too much when greedy (default) or
> too little when non-greedy. The relation is thus: All regular languages
are
> context-free, but not all context-free languages are regular.
>
> The nested, paired parentheses in the print_r() output show that the
> print_r() output language cannot be regular: the language of well-
> formed/balanced parentheses/brackets (bracket language) is the textbook
> example of a context-free language that is not regular, which can be shown
> by application of the pumping lemma for regular languages.
>
> PHP supports Perl-Compatible Regular Expressions which provide the "(?R.)"
> feature to match text recursively. This makes it possible to match nested
> balanced parentheses to a certain degree (as far as stack memory permits).
>
> However, to be on the safe side you would need to write a parser for this
> language (which would basically be an implementation of a deterministic
> push-down automaton, but can use regular expressions; but depending on the
> programming language that is not necessarily the most efficient approach -
> in PHP, where regular expressions are not objects, it probably is not).
>
> But it is easier to use existing parsers for other formats. For example,
> since you say in <news:568d6f9c$0$23759$e4fe514c@news.xs4all.nl> that you
> need human-readable output (which excludes the built-in serialization
> mechanism to binary), you should look into JSON which PHP supports with an
> extension. Other alternatives that come to mind are CSON, YAML, and XML
(in
> that order, with increasing overhead). PHP also has built-in XML support,
> and there is a PECL extension for YAML (not bundled with PHP).
>
> <https://en.wikipedia.org/wiki/Chomsky_hierarchy>
> <http://php.net/manual/en/regexp.reference.recursive.php>
> <http://php.net/json>
> <http://php.net/xml>
> <http://php.net/yaml>
>
> --
> PointedEars
> Zend Certified PHP Engineer
> Twitter: @PointedEars2
> Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2016-01-07 14:20 +0100 |
| Message-ID | <3446008.pcFhFErqYX@PointedEars.de> |
| In reply to | #16136 |
R.Wieser wrote: ^^ > Thomas, This is _not_ e-mail. Therefore, it is customary to provide an attribution line to attribute the text of a quotation level (indicated by the quotation character “>”) to an author, and to skip any greetings to a particular person because we are *all* the audience here. Your newsreader does insert the attribution automatically, although in an overly verbose way (but there solutions to that common problem exist). > Thanks for your opinions. But as your post does not actually contain > anything constructive -- much less an attempt to answer my question -- It was very constructive as it answered your question in great detail, you just did not (care to) notice it. Whether because of natural carelessness or your current inappropriate quoting style I am not sure yet. > I can't do much, if anything with it. Your problem. > […] > Rudy Wieser <-- Blimy! There it is ! My first name! :-) I was referring to the “From” header field of your posting (perhaps addressed by the “Sender” field in your software), whose value has a name part that is automatically used by newsreaders for the attribution line. > [top post with OjE attribution novel] <http://www.netmeister.org/news/learn2quote.html> <http://www.catb.org/esr/faqs/smart-questions.html> -- PointedEars Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-01-07 15:31 +0100 |
| Message-ID | <568e765a$0$23801$e4fe514c@news.xs4all.nl> |
| In reply to | #16137 |
Thomas, > This is _not_ e-mail. You don't say ! (imagine that nicolas cage face here if you want). > Therefore, it is customary to provide an attribution line > to attribute the text of a quotation level (indicated by > the quotation character ">") to an author, What do you think that my initial mentioning of your name was for than ? > and to skip any greetings to a particular person because > we are *all* the audience here Wrong. I was not greeting you, I was *addressing* you, and your post. Quite a difference. ... you're not half as observant as you think you are, are you ? > > I can't do much, if anything with it. > > Your problem. No, not really. There are enough people left who could know the answer, or come up with something constructive. As has already been done. :-) > I was referring to the "From" header field of your posting Well, tough for you. I don't think I'll change something I've been using in newsgroups for over a decade because you have a preference otherwise. Sorry. Regards, Rudy Wieser -- Origional message: Thomas 'PointedEars' Lahn <PointedEars@web.de> schreef in berichtnieuws 3446008.pcFhFErqYX@PointedEars.de... > R.Wieser wrote: > ^^ > > > Thomas, > > This is _not_ e-mail. Therefore, it is customary to provide an attribution > line to attribute the text of a quotation level (indicated by the quotation > character ">") to an author, and to skip any greetings to a particular > person because we are *all* the audience here. Your newsreader does insert > the attribution automatically, although in an overly verbose way (but there > solutions to that common problem exist). > > > Thanks for your opinions. But as your post does not actually contain > > anything constructive -- much less an attempt to answer my question -- > > It was very constructive as it answered your question in great detail, you > just did not (care to) notice it. Whether because of natural carelessness > or your current inappropriate quoting style I am not sure yet. > > > I can't do much, if anything with it. > > Your problem. > > > [.] > > Rudy Wieser <-- Blimy! There it is ! My first name! :-) > > I was referring to the "From" header field of your posting (perhaps > addressed by the "Sender" field in your software), whose value has a name > part that is automatically used by newsreaders for the attribution line. > > > [top post with OjE attribution novel] > > <http://www.netmeister.org/news/learn2quote.html> > <http://www.catb.org/esr/faqs/smart-questions.html> > > -- > PointedEars > Zend Certified PHP Engineer > <http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2 > Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2016-01-07 16:00 +0100 |
| Message-ID | <8648754.t1aGJG4q6u@PointedEars.de> |
| In reply to | #16143 |
R.Wieser wrote: [Repaired attribution line] > [Thomas 'PointedEars' Lahn wrote:] >> This is _not_ e-mail. > > You don't say ! (imagine that nicolas cage face here if you want). So you should not write a NetNews article as if it was an e-mail. >> Therefore, it is customary to provide an attribution line >> to attribute the text of a quotation level (indicated by >> the quotation character ">") to an author, > > What do you think that my initial mentioning of your name was for than ? There are many people with first name “Thomas” on the Net, likely more than one in this newsgroup over a period of two months. >> and to skip any greetings to a particular person because >> we are *all* the audience here > > Wrong. I was not greeting you, I was *addressing* you, and your post. > Quite a difference. > > ... you're not half as observant as you think you are, are you ? Sorry to break this to you, but you have not yet understood where you are posting to. >> > I can't do much, if anything with it. >> Your problem. > > No, not really. Yes, really. > There are enough people left who could know the answer, This is not a helpdesk, it is a newsgroup for technical discussion. You are having an X–Y problem: You have a problem and have, according to the overwhelming majority of contributors so far, in academic vernacular, a really stupid idea how to solve it, partially because you have not properly defined the problem yet. You want us (the aforementioned group) not to tell you that we think it is a really stupid idea, and to jump through your hoops in order to realize it for you for free. That is not going to happen. However, we can provide you with suggestions of alternative approaches that we know from experience have worked for us for the same problem or similar problems in the past, and would probably work for you as well, or we can made an educated guess that they are very likely to work for you. And we have done so. That you are evidentially a careless person and do not realize that, and still want to realize your really stupid idea is your problem alone. > or come up with something constructive. As has already been done. :-) AISB, my posting was constructive, you just do not realize it yet. Instead of just saying that *you* found it not constructive, you could say that you did not understand (all of) it, ask about the things you did not understand, and if you would do that politely, there is every chance that your questions would be answered. That is what a *smart* person would do. >> I was referring to the "From" header field of your posting > > Well, tough for you. No, not really. I only need to adjust my scorefile and, if I do that often enough, leave you without any chance of further advice from me regarding *any* problem you may face in the future. IOW, instead of telling you all this, it would be easier for me to filter you out of my busy life, and (implicitly) recommend that to others as well. But I still doubt that you want that to happen. > I don't think I'll change something I've been using in newsgroups for over > a decade because you have a preference otherwise. Sorry. As you could have read, it is not only my preference. Since it is you making a request in a written text, it is in your best interest to consider the preferences of your readership, because they are doing the reading and answering in their precious free time. Nobody here is required to read your postings or reply to them. > [top posting with attribution novel again] Score adjusted -- PointedEars Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-01-07 13:45 -0500 |
| Message-ID | <n6mbjl$o41$2@jstuckle.eternal-september.org> |
| In reply to | #16143 |
On 1/7/2016 9:31 AM, R.Wieser wrote: > Thomas, > >> This is _not_ e-mail. > > You don't say ! (imagine that nicolas cage face here if you want). > >> Therefore, it is customary to provide an attribution line >> to attribute the text of a quotation level (indicated by >> the quotation character ">") to an author, > > What do you think that my initial mentioning of your name was for than ? > >> and to skip any greetings to a particular person because >> we are *all* the audience here > > Wrong. I was not greeting you, I was *addressing* you, and your post. > Quite a difference. > > ... you're not half as observant as you think you are, are you ? > >>> I can't do much, if anything with it. >> >> Your problem. > > No, not really. There are enough people left who could know the answer, or > come up with something constructive. As has already been done. :-) > >> I was referring to the "From" header field of your posting > > Well, tough for you. I don't think I'll change something I've been using in > newsgroups for over a decade because you have a preference otherwise. Sorry. > > Regards, > Rudy Wieser > > > -- Origional message: > Thomas 'PointedEars' Lahn <PointedEars@web.de> schreef in berichtnieuws > 3446008.pcFhFErqYX@PointedEars.de... >> R.Wieser wrote: >> ^^ >> >>> Thomas, >> >> This is _not_ e-mail. Therefore, it is customary to provide an > attribution >> line to attribute the text of a quotation level (indicated by the > quotation >> character ">") to an author, and to skip any greetings to a particular >> person because we are *all* the audience here. Your newsreader does > insert >> the attribution automatically, although in an overly verbose way (but > there >> solutions to that common problem exist). >> >>> Thanks for your opinions. But as your post does not actually contain >>> anything constructive -- much less an attempt to answer my question -- >> >> It was very constructive as it answered your question in great detail, you >> just did not (care to) notice it. Whether because of natural carelessness >> or your current inappropriate quoting style I am not sure yet. >> >>> I can't do much, if anything with it. >> >> Your problem. >> >>> [.] >>> Rudy Wieser <-- Blimy! There it is ! My first name! :-) >> >> I was referring to the "From" header field of your posting (perhaps >> addressed by the "Sender" field in your software), whose value has a name >> part that is automatically used by newsreaders for the attribution line. >> >>> [top post with OjE attribution novel] >> Rudy, Don't worry about Pointed Head. He's a well-known troll in multiple newsgroups. He thinks the world of usenet has to revolve around HIS rules. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-01-07 20:18 +0100 |
| Message-ID | <568eb982$0$23732$e4fe514c@news.xs4all.nl> |
| In reply to | #16152 |
Jerry, > Don't worry about Pointed Head. He's a well-known troll > in multiple newsgroups. He thinks the world of usenet has > to revolve around HIS rules. I was almost going to have a sparring match with him (can't stand that kind of pompous and not helping attitude much as you might have noticed :-) ), but realized that I would only waste my energy on him. So, he gets ignored instead. Thanks for the warning/heads-up though. I had a tiny doubt lingering to my handling of the situation/guy, but thats gone now too. Regards, Rudy Wieser -- Origional message: Jerry Stuckle <jstucklex@attglobal.net> schreef in berichtnieuws n6mbjl$o41$2@jstuckle.eternal-september.org... > On 1/7/2016 9:31 AM, R.Wieser wrote: > > Thomas, > > > >> This is _not_ e-mail. > > > > You don't say ! (imagine that nicolas cage face here if you want). > > > >> Therefore, it is customary to provide an attribution line > >> to attribute the text of a quotation level (indicated by > >> the quotation character ">") to an author, > > > > What do you think that my initial mentioning of your name was for than ? > > > >> and to skip any greetings to a particular person because > >> we are *all* the audience here > > > > Wrong. I was not greeting you, I was *addressing* you, and your post. > > Quite a difference. > > > > ... you're not half as observant as you think you are, are you ? > > > >>> I can't do much, if anything with it. > >> > >> Your problem. > > > > No, not really. There are enough people left who could know the answer, or > > come up with something constructive. As has already been done. :-) > > > >> I was referring to the "From" header field of your posting > > > > Well, tough for you. I don't think I'll change something I've been using in > > newsgroups for over a decade because you have a preference otherwise. Sorry. > > > > Regards, > > Rudy Wieser > > > > > > -- Origional message: > > Thomas 'PointedEars' Lahn <PointedEars@web.de> schreef in berichtnieuws > > 3446008.pcFhFErqYX@PointedEars.de... > >> R.Wieser wrote: > >> ^^ > >> > >>> Thomas, > >> > >> This is _not_ e-mail. Therefore, it is customary to provide an > > attribution > >> line to attribute the text of a quotation level (indicated by the > > quotation > >> character ">") to an author, and to skip any greetings to a particular > >> person because we are *all* the audience here. Your newsreader does > > insert > >> the attribution automatically, although in an overly verbose way (but > > there > >> solutions to that common problem exist). > >> > >>> Thanks for your opinions. But as your post does not actually contain > >>> anything constructive -- much less an attempt to answer my question -- > >> > >> It was very constructive as it answered your question in great detail, you > >> just did not (care to) notice it. Whether because of natural carelessness > >> or your current inappropriate quoting style I am not sure yet. > >> > >>> I can't do much, if anything with it. > >> > >> Your problem. > >> > >>> [.] > >>> Rudy Wieser <-- Blimy! There it is ! My first name! :-) > >> > >> I was referring to the "From" header field of your posting (perhaps > >> addressed by the "Sender" field in your software), whose value has a name > >> part that is automatically used by newsreaders for the attribution line. > >> > >>> [top post with OjE attribution novel] > >> > > Rudy, > > Don't worry about Pointed Head. He's a well-known troll in multiple > newsgroups. He thinks the world of usenet has to revolve around HIS rules. > > -- > ================== > Remove the "x" from my email address > Jerry Stuckle > jstucklex@attglobal.net > ==================
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2016-01-07 20:52 +0100 |
| Message-ID | <5443777.XFmq9X48zT@PointedEars.de> |
| In reply to | #16153 |
R.Wieser <address@not.available> wrote: > [anti-social address mungers padding each other on the back] You think that Jerry Stuckle – if that is his real name – is your friend for confirming your misconceptions, but he really is not. *He* is the troll here calling everyone who disagrees with his mostly uninformed opinion a troll, misleading you to believe that people who are not giving you exactly what you want would not help you with that. Of course, I do not expect you to believe me; you can search the archives and compare the S/N ratios for yourself. In any case, I better check the “From” header field first next time. The record shows that address munging is always a good luser indicator. *PLONK* -- PointedEars Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-01-07 15:29 -0500 |
| Message-ID | <n6mhmm$jhi$2@jstuckle.eternal-september.org> |
| In reply to | #16155 |
On 1/7/2016 2:52 PM, Thomas 'PointedEars' Lahn wrote: > R.Wieser <address@not.available> wrote: > >> [anti-social address mungers padding each other on the back] > > You think that Jerry Stuckle – if that is his real name – is your friend for > confirming your misconceptions, but he really is not. *He* is the troll > here calling everyone who disagrees with his mostly uninformed opinion a > troll, misleading you to believe that people who are not giving you exactly > what you want would not help you with that. Of course, I do not expect you > to believe me; you can search the archives and compare the S/N ratios for > yourself. > > In any case, I better check the “From” header field first next time. > The record shows that address munging is always a good luser indicator. > > *PLONK* > So why are so widely known as a troll across multiple newsgroups, Pointed Head? Try comp.lang.javascript, for instance. And there are more. The truth always hurts, doesn't it? And BTW - there are a lot of people who disagree with me that I respect highly. Unlike you, I can handle disagreement. But I don't put up with trolls. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2016-01-07 22:42 +0000 |
| Message-ID | <070120162242275807%timstreater@greenbee.net> |
| In reply to | #16152 |
In article <n6mbjl$o41$2@jstuckle.eternal-september.org>, Jerry Stuckle <jstucklex@attglobal.net> wrote: >Rudy, > >Don't worry about Pointed Head. He's a well-known troll in multiple >newsgroups. He thinks the world of usenet has to revolve around HIS rules. Jerry is quite right here. -- "That which can be asserted without evidence, can be dismissed without evidence." -- Christopher Hitchens
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-01-08 10:43 +0100 |
| Message-ID | <568f8447$0$23790$e4fe514c@news.xs4all.nl> |
| In reply to | #16159 |
Tim, > Jerry is quite right here. Thanks for the confirmation. I already got that feeling when I read thomas his first "reply" to me, which than caused me to responded as I did. Rather civilized, but with a "no nonsense" undertone. Which he (ofcourse) ignored ... But I guess we should be glad people like him exist. Without them we would probably not realize how belessed we are with most of the other people around us. :-) Regards, Rudy Wieser -- Origional message: Tim Streater <timstreater@greenbee.net> schreef in berichtnieuws 070120162242275807%timstreater@greenbee.net... > In article <n6mbjl$o41$2@jstuckle.eternal-september.org>, Jerry Stuckle > <jstucklex@attglobal.net> wrote: > > >Rudy, > > > >Don't worry about Pointed Head. He's a well-known troll in multiple > >newsgroups. He thinks the world of usenet has to revolve around HIS rules. > > Jerry is quite right here. > > -- > "That which can be asserted without evidence, can be dismissed without > evidence." > -- Christopher Hitchens
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2016-01-11 09:07 +0100 |
| Message-ID | <569362A6.2030707@arnowelzel.de> |
| In reply to | #16110 |
R.Wieser schrieb am 2016-01-06 um 17:18: > I'm saving the contents of an array-of-arrays into a string with print_r(). > Now I want to parse the contents of that string into an array-of-arrays > again. It's way easier to use serialize() and unserialize() for this purpose: <http://php.net/manual/en/function.serialize.php> <http://php.net/manual/en/function.unserialize.php> -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-01-11 08:05 -0500 |
| Message-ID | <n70969$cp0$4@jstuckle.eternal-september.org> |
| In reply to | #16170 |
On 1/11/2016 3:07 AM, Arno Welzel wrote: > R.Wieser schrieb am 2016-01-06 um 17:18: > >> I'm saving the contents of an array-of-arrays into a string with print_r(). >> Now I want to parse the contents of that string into an array-of-arrays >> again. > > It's way easier to use serialize() and unserialize() for this purpose: > > <http://php.net/manual/en/function.serialize.php> > <http://php.net/manual/en/function.unserialize.php> > > > He said it had to be human readable, and has already discarded serializing the data. I guess you have trouble reading, also. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2016-01-11 23:51 +0100 |
| Message-ID | <56943207.1060207@arnowelzel.de> |
| In reply to | #16176 |
Jerry Stuckle schrieb am 2016-01-11 um 14:05: > On 1/11/2016 3:07 AM, Arno Welzel wrote: >> R.Wieser schrieb am 2016-01-06 um 17:18: >> >>> I'm saving the contents of an array-of-arrays into a string with print_r(). >>> Now I want to parse the contents of that string into an array-of-arrays >>> again. >> >> It's way easier to use serialize() and unserialize() for this purpose: >> >> <http://php.net/manual/en/function.serialize.php> >> <http://php.net/manual/en/function.unserialize.php> >> >> >> > > He said it had to be human readable, and has already discarded > serializing the data. I guess you have trouble reading, also. Where did the *quoted* posting say it has to be human readable? -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2016-01-12 00:31 +0100 |
| Message-ID | <11918270.im3B3cPQOs@PointedEars.de> |
| In reply to | #16185 |
Arno Welzel wrote: > Jerry Stuckle schrieb am 2016-01-11 um 14:05: >> On 1/11/2016 3:07 AM, Arno Welzel wrote: >>> R.Wieser schrieb am 2016-01-06 um 17:18: >>>> I'm saving the contents of an array-of-arrays into a string with >>>> print_r(). Now I want to parse the contents of that string into an >>>> array-of-arrays again. >>> It's way easier to use serialize() and unserialize() for this purpose: >>> <http://php.net/manual/en/function.serialize.php> >>> <http://php.net/manual/en/function.unserialize.php> >> >> He said it had to be human readable, and has already discarded >> serializing the data. I guess you have trouble reading, also. > > Where did the *quoted* posting say it has to be human readable? To be fair, as you had been rather late to the party (4 days later), you should have read the whole thread (as it was not so long), at least not *only* the OP, before your first follow-up. serialize()/unserialize() had already been suggested by more than one person, at least one of which you have not killfiled, I suppose ;-) and *then* discarded by the OP. Likewise, JSON had been suggested in the same way. So, while your attempt at completeness is commendable, it was unnecessary. -- PointedEars Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-01-11 20:55 -0500 |
| Message-ID | <n71m91$tv4$3@jstuckle.eternal-september.org> |
| In reply to | #16185 |
On 1/11/2016 5:51 PM, Arno Welzel wrote: > Jerry Stuckle schrieb am 2016-01-11 um 14:05: > >> On 1/11/2016 3:07 AM, Arno Welzel wrote: >>> R.Wieser schrieb am 2016-01-06 um 17:18: >>> >>>> I'm saving the contents of an array-of-arrays into a string with print_r(). >>>> Now I want to parse the contents of that string into an array-of-arrays >>>> again. >>> >>> It's way easier to use serialize() and unserialize() for this purpose: >>> >>> <http://php.net/manual/en/function.serialize.php> >>> <http://php.net/manual/en/function.unserialize.php> >>> >>> >>> >> >> He said it had to be human readable, and has already discarded >> serializing the data. I guess you have trouble reading, also. > > Where did the *quoted* posting say it has to be human readable? > > I know it's hard for trolls, but you really need to learn to read. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-01-12 11:11 +0100 |
| Message-ID | <5694d0c2$0$23771$e4fe514c@news.xs4all.nl> |
| In reply to | #16185 |
Arno, > Where did the *quoted* posting say it has to be human readable? That would be my second post (first reply), where I, in the first line of the first paragraph, said: "I'm using it to store the array-of-arrays into a file in human-readable format." I did have a look at (de)serializing. As I already assumed and mentioned to ben as such, its not really ment to be read or altered by humans ... Regards, Rudy Wieser -- Origional message Arno Welzel <usenet@arnowelzel.de> schreef in berichtnieuws 56943207.1060207@arnowelzel.de... > Jerry Stuckle schrieb am 2016-01-11 um 14:05: > > > On 1/11/2016 3:07 AM, Arno Welzel wrote: > >> R.Wieser schrieb am 2016-01-06 um 17:18: > >> > >>> I'm saving the contents of an array-of-arrays into a string with print_r(). > >>> Now I want to parse the contents of that string into an array-of-arrays > >>> again. > >> > >> It's way easier to use serialize() and unserialize() for this purpose: > >> > >> <http://php.net/manual/en/function.serialize.php> > >> <http://php.net/manual/en/function.unserialize.php> > >> > >> > >> > > > > He said it had to be human readable, and has already discarded > > serializing the data. I guess you have trouble reading, also. > > Where did the *quoted* posting say it has to be human readable? > > > -- > Arno Welzel > http://arnowelzel.de > http://de-rec-fahrrad.de > http://fahrradzukunft.de
[toc] | [prev] | [next] | [standalone]
Page 5 of 6 — ← Prev page 1 2 3 4 [5] 6 Next page →
Back to top | Article view | comp.lang.php
csiph-web