graham23s Posted August 28, 2007 Share Posted August 28, 2007 Hi Guys, finally got my code done for reading .xml files but when it comes to assigning the results back for the size into mb and gb i don't know what to do this code: foreach($xml->{"file"} as $nfile) { $nposter = (string) trim($nfile['poster']); $nposter = ($nposter); $ndate = 0 + trim($nfile['date']); $nsubject = (string) trim($nfile['subject']); // To find num of segments in subject: $nsubjsegs = 0 + subj_seg($nsubject); // To find out if Par or not $npar = (stristr($nsubject, "par2")?0:1); $nsubject = ($nsubject); $groups = array(); foreach($nfile->groups->group as $group) { $groups[] = (string) trim($group); } $ngroups = (serialize($groups)); $size = 0; foreach($nfile->segments->segment as $segment) $size += $segment['bytes']; } gives back this for the size: 52617506 can anyone tell me how to go about changing size into 1 more readable like in megabytes and gigabytes. thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/67085-working-out-file-sizes-xml/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.