Przykładowo mam plik xml:
<?xml version="1.0" encoding="utf-8"?> <documentHeader> <companiesId>45</companiesId> <typeNotification>Delivery</typeNotification> <date>2015-10-22</date> <description>Przykładowy opis dokumentu</description> </documentHeader>
Konwertowanie na tablice:
$xml = simplexml_load_file('xml/'. $file); //xml format to array $json = json_encode($xml); $array = json_decode($json, TRUE);
teraz gdy sprawdzę typ companiesId:
Jak wymusić aby było to integer ?