$value) { // Escape inner quotes and wrap all contents in new quotes. $data[$key] = '"' . str_replace('"', '""', $data[$key]) . '"'; // Remove