Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16118

Re: parsing print_r() output with preg_match_all()

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.php
Subject Re: parsing print_r() output with preg_match_all()
Date 2016-01-06 21:12 +0000
Organization A noiseless patient Spider
Message-ID <87fuyaza37.fsf@bsb.me.uk> (permalink)
References <568d3dcf$0$23748$e4fe514c@news.xs4all.nl> <87r3huzevd.fsf@bsb.me.uk> <568d6f9c$0$23759$e4fe514c@news.xs4all.nl>

Show all headers | View raw


"R.Wieser" <address@not.available> writes:

>> 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.

Well the output of serialise is human-readable (just about).  It's not
ideal, but then parsing print_r output is not ideal either.  In fact,
it's not even possible in all cases though you may be able to make
enough assumptions about what's in the strings to get away with it.

But I would seriously consider some other plan.  If it's always going to
be just an array of arrays of strings, you could design your own
human-readable format whilst making it (much) easier to read back.

<snip>
-- 
Ben.

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web