note 105604 modified in function.uasort by danbrown

From: Date: Wed, 31 Aug 2011 14:00:02 +0000
Subject: note 105604 modified in function.uasort by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182856@lists.php.net to get a copy of this message
for a simple case insensitive compare you can use this (php >= 5.3): <?php $greetings = array('howdy', 'Hey', 'aloha he'); uasort($a, function($a, $b){ return strcasecmp($a, $b); }); //$a == array('aloha he', 'howdy', 'Hey'); ?> --was-- for a simple case insensitive compare you can use this (php >= 5.3): $greetings = array('howdy', 'Hey', 'aloha he'); uasort($a, function($a, $b){ return strcasecmp($a, $b); }); //$a == array('aloha he', 'howdy', 'Hey'); http://php.net/manual/en/function.uasort.php

« previous php.notes (#182856) next »