note 69792 modified in function.usort by thiago

From: Date: Tue, 22 Jul 2008 19:10:17 +0000
Subject: note 69792 modified in function.usort by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142556@lists.php.net to get a copy of this message
To markus: your function can be simplified to: <?php function SortByName($a, $b) { return strcasecmp($a['name'], $b['name']); } usort($test, 'SortByName'); ?> Replace strcasecmp for strcmp if you want case sensitive comparition. --was-- To markus: your function can be simplified to: function SortByName($a, $b) { return strcasecmp($a['name'], $b['name']); } usort($test, 'SortByName'); Replace strcasecmp for strcmp if you want case sensitive comparition. http://php.net/manual/en/function.usort.php

« previous php.notes (#142556) next »