On Sat, 25 Oct 2003 04:03:12 +0300, you wrote:

>I don't know what the names are. I just know that there might be numbers. :)
>
>It still doesn't work. It gives very odd results with the $x_out variables.

<?php
        function cmp ($a, $b)
        {
                if ($a == $b)
                {
                        return (0);
                }
                
                $a = explode ('_', $a);
                $b = explode ('_', $b);
                
                if ($a[0] == $b[0])
                {
                        return (((int)$a[1] < (int)$b[1]) ? -1 : 1);
                }
                return (($a[0] < $b[0]) ? -1 : 1);
        }
        
        $a = array('file_3.ext', 'file_10.ext', 'xxx.ext', 'file_2.ext',
'file_1.ext');
        
        usort ($a, 'cmp');
        
        print_r ($a);
?>

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

Reply via email to