Reactjs Sort Array Php Functions Definitions