Converting from table to php array