Arranging Text Via Ascending Order PHP
<p>I am using this code to write to a file called posts.txt via POST:</p>

<pre><code>&lt;?php
if (isset($_POST['username']) &amp;&amp; isset($_POST['score'])) {
$fp = fopen("posts.txt", "r");
$size = filesize("posts.txt");
if ($size &gt; 0) {
    $script = fread($fp, $size);
} else {
    $script = "";
}
fclose($fp);
$script = '&lt;div style="width : 300px; position : relative"&gt;&lt;font face="helvetica, geneva, sans serif" size="6"&gt;&lt;b&gt;' . $_POST['score'] . '&lt;/b&gt;&lt;/font&gt;&lt;font face="helvetica, geneva, sans serif" size="4"&gt;&lt;i&gt; scored by ' . $_POST['username'] . '&lt;/i&gt; &lt;em&gt; on '. $_POST['date'] . '&lt;/em&gt;&lt;/font&gt;&lt;br&gt;&lt;img src="Bar.png" /&gt;&lt;/div&gt;' . $script;
$f = fopen("posts.txt", "w");
fwrite($f, $script);
fclose($f);
echo "&lt;html&gt;&lt;head&gt;&lt;title&gt;Success!&lt;/title&gt;&lt;/head&gt;&lt;body&gt;Submission Posted!&lt;/body&gt;&lt;/html&gt;";
}    

else {
    echo "&lt;html&gt;&lt;head&gt;&lt;title&gt;POST Request Error&lt;/title&gt;&lt;/head&gt;&lt;body&gt;Most set method to POST and params to be 'username' and 'score'&lt;/body&gt;&lt;/html&gt;";
}
?&gt;
</code></pre>

<p>I would really appreciate it if you could tell me how I could arrange the different 'posts' in ascending order depending on <code>$_POST['score']</code>. I am completely new to php as you may be able to tell from the question so please explain it in your simplest terms. Also any code provided helps twice as much!!</p>
