note 113484 added to function.array-multisort

From: Date: Thu, 17 Oct 2013 08:08:34 +0000
Subject: note 113484 added to function.array-multisort
Groups: php.notes 
Request: Send a blank email to php-notes+get-196574@lists.php.net to get a copy of this message
If you do not have PHP 5.4 installed yet and you cannot use SORT_NATURAL. This function sorts arrays natural multi-dimensional based on key value this function can be used for arrays as array ( name => array( key => value ) ) and array( name => value ). arrays as array( name => array( key => value), name => value) are not supported. <?php static function natcasesortRecursive(&$aArray) { $bHasArrays = false; foreach ($aArray as $sKey => &$mValue) { if (true === is_array($mValue)) { self::natcasesortRecursive($mValue); $bHasArrays = true; } } if (true === $bHasArrays) { uksort($aArray, 'strnatcasecmp'); } else { natcasesort($aArray); } } ?> ---- Server IP: 91.199.167.223 Probable Submitter: 82.148.208.233 ---- Manual Page -- http://php.net/manual/en/function.array-multisort.php Edit -- https://master.php.net/note/edit/113484 Del: integrated -- https://master.php.net/note/delete/113484/integrated Del: useless -- https://master.php.net/note/delete/113484/useless Del: bad code -- https://master.php.net/note/delete/113484/bad+code Del: spam -- https://master.php.net/note/delete/113484/spam Del: non-english -- https://master.php.net/note/delete/113484/non-english Del: in docs -- https://master.php.net/note/delete/113484/in+docs Del: other reasons-- https://master.php.net/note/delete/113484 Reject -- https://master.php.net/note/reject/113484 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196574) next »