note 69292 deleted from function.var-export by cmb
| From: | cmb@php.net | Date: | Wed, 09 Sep 2015 13:33:35 +0000 |
| Subject: | note 69292 deleted from function.var-export by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203753@lists.php.net to get a copy of this message | ||
Note Submitter: nobody at nowhere dot de
----
Here is a bit code, what will read an saved object and turn it into an array.
Please note: It is very lousy style. Only an an idea.
$data = file_get_contents("test.txt");
$data = preg_replace('/class .*{/im', 'array (', $data);
$data = preg_replace('/\}/im', ')', $data);
$data = preg_replace('/var /im', '', $data);
$data = preg_replace('/;/im', ',', $data);
$data = preg_replace('/=/im', '=>', $data);
$data = preg_replace('/=>>/im', '=>', $data);
$data = preg_replace('/\$(.*?) /im', '"$1"', $data);
eval('$O = ' . $data . ';');
print_r($O);