selection sort using php (replacing min and max) and javascript(just replacing min)