Limit XML data when converting JSON to XML - PHP
问题 I am using this code to convert JSON to XML and everything is working fine. I am getting 200 records in the XML but i want to limit it to 50. I just want to create the XML file with latest 50 records. Instead of converting whatever we have in JSON to XML. function array_to_xml( $data, &$xml_data ) { foreach( $data as $key => $value ) { if( is_numeric($key) ){ $key = 'item'.$key; //dealing with <0/>..<n/> issues } if( is_array($value) ) { $subnode = $xml_data->addChild($key); array_to_xml(