How can I parse the output of var_dump
in PHP to create an array?
I had a similar problem : a long runing script produced at the end a vardump of large array. I had to parse it back somehow for further analyzis. My solution was like this:
cat log.stats |
sed 's/\[//g' |
sed 's/\]//g' |
sed -r 's/int\(([0-9]+)\)/\1,/g' |
sed 's/\}/\),/g' |
sed -r 's/array\([0-9]+\) \{/array(/g' >
log.stats.php