note 110554 deleted from function.sort by aharvey
| From: | aharvey@php.net | Date: | Wed, 07 Nov 2012 00:36:09 +0000 |
| Subject: | note 110554 deleted from function.sort by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191787@lists.php.net to get a copy of this message | ||
Note Submitter: no at example dot com
----
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
}
}