Javascript Copy And Sort Array Php Formatter