Link to home
Start Free TrialLog in
Avatar of terencepires
terencepires

asked on

Problems using sort() function

Hi there,

I'm trying to sort an array in ASC order, by doing the following operations, but instead of outputing a sorted array, i get a "1" integer...

Here's what returns print_r($a)

before sorting :

Array ( [0] => . [1] => .. [2] => accueil_php.php [3] => commande.php [4] => configure.php [5] => connect.php [6] => connexion.php [7] => database_tables.php [8] => date-heure.php [9] => db_funcs.php [10] => eachtest.php [11] => errors.php [12] => form_mail.php [13] => form_selection.php [14] => formulaire.php [15] => functions.php [16] => image.php [17] => insert_test.php [18] => ipaddr.php [19] => membres.php [20] => multiples.php [21] => news.php [22] => poubelle.php [23] => rand.php [24] => resultat.php [25] => sites.php [26] => string_compare.php [27] => tableau_associatif.php [28] => tableau_associatif_each.php [29] => tableau_associatif_foreach.php [30] => upload [31] => upload.php [32] => viewnews.php )

After sorting :

1

And i get the same result using array_multisort or any other sorting function...

That's making me crazy!

Can someone help ?

Thx

Terence
$a=scandir('.');
$a=sort($a);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of terencepires
terencepires

ASKER

thanks :)