Write helper functions for third attempt at selection sort in php