Hi,
I'm trying to recreate an array from a var_export()'ed array stored in
a database, using eval().
Basically I have something this in my database:
array (
0 => 1,
1 => 2,
2 => array (
0 => 'a',
1 => 'b',
2 => 'c',
),
)
If I then read it into a variable:
$stored_array = /*whatever_sql_s tatements_for_r eading_stored_a rray*/
I would think that something like:
eval('$recreate d_array = $store_array');
would do, but it sjust doesn't work, and I'm quite stumped with this
simple task, but I'd appreciate anyone' guidance.
Cheers!
- José
p.s. The solution would be be a welcome addition to the PHP
documentation since there is only a hint of how one could do this but
not a working example.
I'm trying to recreate an array from a var_export()'ed array stored in
a database, using eval().
Basically I have something this in my database:
array (
0 => 1,
1 => 2,
2 => array (
0 => 'a',
1 => 'b',
2 => 'c',
),
)
If I then read it into a variable:
$stored_array = /*whatever_sql_s tatements_for_r eading_stored_a rray*/
I would think that something like:
eval('$recreate d_array = $store_array');
would do, but it sjust doesn't work, and I'm quite stumped with this
simple task, but I'd appreciate anyone' guidance.
Cheers!
- José
p.s. The solution would be be a welcome addition to the PHP
documentation since there is only a hint of how one could do this but
not a working example.
Comment