0) { $default_id = taxSettings()['default_id']; $rows = []; while ($id_row = mysqli_fetch_row($sql)) { $tax = taxRow($id_row[0]); $rows[] = [ 'tax_id' => intval($tax['tax_id']), 'tax_name' => $tax['tax_name'], 'tax_percent' => floatval($tax['tax_percent']), 'tax_description' => $tax['tax_description'], 'tax_registration_number' => $tax['tax_registration_number'], 'tax_archived_at' => $tax['tax_archived_at'], 'tax_replaced_by' => intval($tax['tax_replaced_by']), 'tax_default' => intval($tax['tax_id']) === $default_id, 'tax_components' => array_map(function ($part) use ($tax) { return ['name' => $part['name'], 'percent' => $part['percent'], 'compound' => $part['compound'], 'registration_number' => $part['registration'] !== '' ? $part['registration'] : (string) $tax['tax_registration_number']]; }, $tax['components']), ]; } echo json_encode(['success' => 'True', 'count' => count($rows), 'data' => $rows]); exit(); } // Output require_once "../read_output.php";