note 103139 rejected from collator.asort by danbrown

From: Date: Mon, 28 Mar 2011 17:47:52 +0000
Subject: note 103139 rejected from collator.asort by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178274@lists.php.net to get a copy of this message
Note Submitter: jeff_walter at kace dot com ---- The above post doesn't work. This example does.. function natsortIntl($number) { return sprintf('%032d', $number); } function sortIntl($array, $natural = true) { $data = $array; if ($natural === true) { $data = preg_replace_callback('~([0-9]+)~', 'natsortIntl', $data); } collator_asort(collator_create('root'), $data); return array_intersect_key($data, $array); <--- This is correct. }

« previous php.notes (#178274) next »