PHP code example of theopeneyes / sort-associative-array
1. Go to this page and download the library: Download theopeneyes/sort-associative-array library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
theopeneyes / sort-associative-array example snippets
use TheOpenEyes\SortAssociativeArray\SortAssociativeArray;
SortAssociativeArray::column($student, 'age', SORT_DESC);
/* Parameters of 'column' method
1. Array - The array you would like to sort by.
2. Column name
3. Sort Direction - Should be either SORT_ASC or SORT_DESC (Optional, Default is SORT_ASC)
*/
use TheOpenEyes\SortAssociativeArray\SortAssociativeArray;
SortAssociativeArray::columnWithChild($student, 'name', 'first_name', SORT_DESC);
/* Parameters of 'columnWithChild' method
1. Array - The array you would like to sort by.
2. Parent column name
3. Child column name
4. Sort Direction - Should be either SORT_ASC or SORT_DESC (Optional, Default is SORT_ASC)
*/