| { php } | |
| array_csort | |
| date | feb.03 |
| update | jun.03 |
| code |
<?php
|
| description | sort multidimensional arrays by column the fine thing is, you can add as many parameters you need, and you can add sort_flags as well (but be shure not to put em into " or ' - took some time for me to get this *g*) .. waiting this func to be included to the next php-release *gg* |
| syntax |
<?php
|
| explanation | $array is the array you want to sort, 'col1' is the name of the column you want to sort, SORT_FLAGS are : SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING you can repeat the 'col',FLAG,FLAG, as often you want, the highest prioritiy is given to the first - so the array is sorted by the last given column first, then the one before ... _______ example: in my case the array has it's index as first dimension (i like that for using foreach later):
<?php
_____________________use the function like this:
<?php
here the resulting array would be:
<?php
|