Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $job_seeker_experience_fieldset = get_user_meta($job_seeker_id, 'ngoh_usr_experience_fieldset', true);
- // Sort the array according to most recently STARTED position
- function compare_date($a, $b){
- // sort by year
- $retval = strnatcmp($a['started_year'], $b['started_year']);
- // if years are identical, sort by month
- if(!$retval) $retval = strnatcmp($a['started_month'], $b['started_month']);
- return $retval;
- }
- // do the sorting using the processing function
- usort($job_seeker_experience_fieldset, __NAMESPACE__ . '\compare_date');
- // reverse the array to make it descending
- $reversed_experience = array_reverse($job_seeker_experience_fieldset);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement