<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ordinare dati estratti da un file xml]]></title><description><![CDATA[<p dir="auto">ciao ragazzi,<br />
sto estraendo tutti i dati contenuti in un file xml per stamparli a video. il problema è che non riesco ad ordinarli in base alla <strong>$Position</strong>.</p>
<p dir="auto">ho letto che esiste una funzione <strong>sort()</strong> ma non sono riuscito a farla funzionare nella maniera corretta.</p>
<p dir="auto">qualcuno può aiutarmi?</p>
<pre><code class="language-php">$file_xml = fopen("test.xml", 'r');

$i=0;
while ( !feof ($file_xml) )
{
    $buffer = trim (fgets ($file_xml) );
    if ($buffer == "&lt;Driver&gt;") 
    {
        $Name                    = trim (strip_tags (fgets ($file_xml) ) );
        $Connected                = trim (strip_tags (fgets ($file_xml) ) );
        $VehFile                = trim (strip_tags (fgets ($file_xml) ) );
        $UpgradeCode            = trim (strip_tags (fgets ($file_xml) ) );
        $VehName                = trim (strip_tags (fgets ($file_xml) ) );
        $CarType                = trim (strip_tags (fgets ($file_xml) ) );
        $CarClass                = trim (strip_tags (fgets ($file_xml) ) );
        $CarNumber                = trim (strip_tags (fgets ($file_xml) ) );
        $TeamName                = trim (strip_tags (fgets ($file_xml) ) );
        $isPlayer                = trim (strip_tags (fgets ($file_xml) ) );
        $GridPos                = trim (strip_tags (fgets ($file_xml) ) );
        $Position                = trim (strip_tags (fgets ($file_xml) ) );
        $ClassGridPos            = trim (strip_tags (fgets ($file_xml) ) );
        $ClassPosition            = trim (strip_tags (fgets ($file_xml) ) );
        $Points                    = trim (strip_tags (fgets ($file_xml) ) );
        $ClassPoints            = trim (strip_tags (fgets ($file_xml) ) );
        $LapRankIncludingDiscos    = trim (strip_tags (fgets ($file_xml) ) );
        $BestLapTime            = trim (strip_tags (fgets ($file_xml) ) );
        $FinishTime                = trim (strip_tags (fgets ($file_xml) ) );
        $Laps                    = trim (strip_tags (fgets ($file_xml) ) );
        $Pitstops                = trim (strip_tags (fgets ($file_xml) ) );
        $FinishStatus            = trim (strip_tags (fgets ($file_xml) ) );
        $ControlAndAids            = trim (strip_tags (fgets ($file_xml) ) );

        echo "$Position. $Name ($TeamName) $FinishTime &lt;br /&gt;";

        $i++;
    }
}

fclose($file_xml);
</code></pre>
]]></description><link>https://dev.connect.gt/topic/155189/ordinare-dati-estratti-da-un-file-xml</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 17:25:33 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/155189.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 Jul 2011 10:18:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ordinare dati estratti da un file xml on Sat, 16 Jul 2011 14:10:40 GMT]]></title><description><![CDATA[<p dir="auto">sort usa gli array devi inserire i tuoi dati in un array e poi usare sort o rsort</p>
]]></description><link>https://dev.connect.gt/post/1015697</link><guid isPermaLink="true">https://dev.connect.gt/post/1015697</guid><dc:creator><![CDATA[linoma]]></dc:creator><pubDate>Sat, 16 Jul 2011 14:10:40 GMT</pubDate></item></channel></rss>