Js Reduce Return Array Php Format Mysql