Is there a way to reconstruct a php structure from its var_dump
ed representation? That is, given something like
array(3) {
[0] =>
int(1)
[1] =>
string(1) "2"
[2] =>
array(1) {
[0] =>
int(3)
}
}
obtain array(1, "2", array(3));
If there's no built-in (library) for this, how to write this function?
For simplicity, let's ignore resources and assume all classes defined.
To clarify, I've got a bunch of var_dump'ed data which I need to process. I don't have access to sources.
UPD: As pointed out in the comments, there's a duplicate question, but I'm not happy with the answer posted there. I don't think using regular expressions is the correct approach here, because every "special" character can also occur within a string literal. For example, that code fails to parse string(6) "ab{;cd"
or string(8) "float(5)"
.