note 110554 added to function.sort

From: Date: Tue, 06 Nov 2012 09:46:22 +0000
Subject: note 110554 added to function.sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-191782@lists.php.net to get a copy of this message
I used this because i couln't get to sort "19,4,5". it word sort it like "19,4,5" so now its sorted "4,5,19" and you could get it back to string but for me that wasn't nessesary. input: array of arrays with string output: sorted array of ints protected function _orderArrayInArray($arrayInArray) { foreach($arrayInArray as &$array){ foreach($array as $key=>$value) { $array[$key] = (int) $value; // cast all strings in the array of an array to int } sort($array, SORT_NUMERIC); // sort the arrays in array } } ---- Server IP: 69.147.83.199 Probable Submitter: 91.194.225.162 ---- Manual Page -- http://www.php.net/manual/en/function.sort.php Edit -- https://master.php.net/note/edit/110554 Del: integrated -- https://master.php.net/note/delete/110554/integrated Del: useless -- https://master.php.net/note/delete/110554/useless Del: bad code -- https://master.php.net/note/delete/110554/bad+code Del: spam -- https://master.php.net/note/delete/110554/spam Del: non-english -- https://master.php.net/note/delete/110554/non-english Del: in docs -- https://master.php.net/note/delete/110554/in+docs Del: other reasons-- https://master.php.net/note/delete/110554 Reject -- https://master.php.net/note/reject/110554 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#191782) next »