PHP: Export to CSV with superscript

1.2k views Asked by At

I have parsed a page with a table and I have an array with data. I need to export this data to CSV file, but want to save formating, especially superscipt. Here is my code:

    $filename = 'data.csv';

    $arraySup['data1'] = 'Value1';
    $arraySup['data2'] = 'Value2';
    $arraySup['data3'] = '<div><b>6</b><sup>3</sup></div>';
    $arraySup['data4'] = '<div><b>2</b><sup>1 1/2</sup><br>49.67</div>';

    $handle = fopen($filename, 'a+');
    fputcsv($handle, $arraySup);
    fclose($handle);

I need to get this on output in my CSV file. Here is link to image what I want to get. https://www.dropbox.com/s/94yfxrveug5uce4/superscript_example.png?dl=0

I will appreciate any help in this question.

0

There are 0 answers