This is a discussion on reloading stored print_r() data back into an array within the PHP General forums, part of the PHP Programming Forums category; Hi all, I am trying to reload a stored print_r() dump back into a usable array but seem to be ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all,
I am trying to reload a stored print_r() dump back into a usable array but seem to be missing something. // the retrieved array as stored in the database directly from print_r() $db_result = 'Array ( [user] => somedude [script] => genPass.php )'; How on earth do I make this into a usable array again where I can call $arr['user'] or something similar ?!? Thanks a lot IA, SomeDude. |
|
|||
|
Somedude wrote:
> Hi all, > > I am trying to reload a stored print_r() dump back into a usable array > but seem to be missing something. > > // the retrieved array as stored in the database directly from print_r() > $db_result = 'Array ( [user] => somedude [script] => genPass.php )'; > > How on earth do I make this into a usable array again where I can call > $arr['user'] or something similar ?!? > > > Thanks a lot IA, > > SomeDude. Why use print_r? Why not use serialize / unserialize instead which is meant for these kind of things? |
|
|||
|
MRB wrote:
> Somedude wrote: > >> Hi all, >> >> I am trying to reload a stored print_r() dump back into a usable array >> but seem to be missing something. >> >> // the retrieved array as stored in the database directly from print_r() >> $db_result = 'Array ( [user] => somedude [script] => genPass.php )'; >> >> How on earth do I make this into a usable array again where I can call >> $arr['user'] or something similar ?!? >> >> >> Thanks a lot IA, >> >> SomeDude. > > > > Why use print_r? Why not use serialize / unserialize instead which is > meant for these kind of things? I am using Pear::Log and that thing dumps array-messages as plain print_r() data in my database. Any change on running something like an 'unserialize' on the array-string ? |