note 94940 deleted from book.simplexml by cmb
| From: | cmb@php.net | Date: | Tue, 28 Jun 2016 23:14:38 +0000 |
| Subject: | note 94940 deleted from book.simplexml by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205833@lists.php.net to get a copy of this message | ||
Note Submitter: Danny from holland
----
I tested all the scripts ive found on this page but none of them wasnt working.
ive made an new script that will work and wont get any memory errors with big xml feeds
<?php
print "<pre>";
$root = simplexml_load_string($XML_URL);
$data = get_object_vars($root);
$producten = array();
foreach ($data['product'] as $keys => $values) {
$producten['product'][$keys] = get_object_vars($data['product']);
foreach ($values as $key => $value) {
$value = str_replace("\r\n", '<br />', $value);
$value = str_replace("\r", '<br />', $value);
$value = str_replace("\n", '<br />', $value);
$producten['product'][$keys][$key] = $value;
}
}
print_R($producten);
print "</pre>";
?>