Witam serdecznie,
jako że jestem "młodym" programistą xml - wczesniej działałem sobie na csv i tablicach, mam pytanie, czy dobrze zapisuję kod, czy powinno się to robić w jakiś inny sposób.
z pliku xml wyciagam sobie dane:
hostingDataBase = simplexml_load_file('./../db/hosting.xml') or http://www.php.net/die ('Błąd: Brak obsługi funkcji SimpleXML'); $currentHosting = $hostingDataBase -> http://www.php.net/current -> customer; $countCurrent = http://www.php.net/count($currentHosting); $archiveHosting = $hostingDataBase -> archive -> customer; $countArchive = http://www.php.net/count($archiveHosting); $cHosting = http://www.php.net/array(); $aHosting = http://www.php.net/array(); foreach ($currentHosting as $cH) { $cHosting[] = $cH; } foreach ($archiveHosting as $aH) { $aHosting[] = $aH; } http://www.php.net/array_multisort(array_column($cHosting, 'date'), SORT_FLAG_CASE | SORT_STRING, array_column($cHosting, 'name'), SORT_FLAG_CASE | SORT_STRING, $cHosting); http://www.php.net/array_multisort(array_column($aHosting, 'date'), SORT_FLAG_CASE | SORT_STRING, array_column($aHosting, 'name'), SORT_FLAG_CASE | SORT_STRING, $aHosting);
$hostingDataBase = './../db/hosting.csv'; $hostingColumns = ['hostingName', 'hostingWeb', 'hostingCat', 'hostingDate', 'nazwaLogin', 'nazwaPasword', 'hostingDescription']; $hostings = http://www.php.net/array_map(function ($record) use ($hostingColumns) {return array_combine($hostingColumns, str_getcsv($record, '|'));}, http://www.php.net/file($hostingDataBase));
http://www.php.net/array(name => $xml -> customer -> name, id => $xml -> customer -> id) etc
foreach($currentCustomers as $cC) { $cC['name'] = blebleble; $cC['id'] = blablabla; ...
foreach ($currentHosting as $key => $cH) { $cHosting[] = ['date' => $cH -> http://www.php.net/date, 'www' => $cH -> www, 'name' => $cH -> name...]; }
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)