I think you should change from using 'rsort' ( a SORT function) to 'array_reverse', a simple reverse function.
Your example of what you desire is wrong.
24-7-2013 will give you the 2013-24-7 that you want.
Here is my sample code.  Try it yourself.

<?
$dag = array("24/7/2013");
echo "Began with: ";var_dump( $dag);
echo "<br>**********<br>";
echo "Try using rsort<br>";
$dagparts = explode("/",$dag[0]);
echo "dagparts: ";
var_dump($dagparts);
echo "<br>**********<br>";
rsort($dagparts);
echo "sorted dagparts: ";
var_dump($dagparts);
echo "<br>**********<br>";
$newdag = implode("-",$dagparts);
echo "newdag: ";
var_dump($newdag);
echo "<br>**********<br>";
echo "Now use array_reverse<br>";
$dagparts = explode("/",$dag[0]);
echo "dagparts: ";
var_dump($dagparts);
echo "<br>**********<br>";
$dagparts = array_reverse($dagparts);
echo "REVERSED dagparts: ";
var_dump($dagparts);
echo "<br>**********<br>";
$newdag = implode("-",$dagparts);
echo "newdag: ";
var_dump($newdag);
echo "<br>**********<br>";


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to