Php Upload CSV and Get Column data
<p>What I am trying to do is Upload a CSV file with Php. The first line is the Column names and below that the data (of course). Each column name can change depends on the end user uploads.  So the main column names we need can change spots (A1 or B1 etc...)  So lets say the column I need is B1 and I need to get all the data in B.  Not sure on how to go by it. So far this is what I have.  Any ideas?</p>

<pre><code>        ini_set("allow_url_fopen", 1);

        $handle = fopen($_FILES['fileToUpload']['tmp_name'], 'r') or die ('cannot open the file');

        while(!feof($handle)) {
            $data[] = fgetcsv($handle);
        }
        var_dump($data);

        fclose($handle);
</code></pre>

<p>UPDATE:
I am importing this file from .CSV to PHP
 <a href="https://i.stack.imgur.com/YA1Um.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YA1Um.jpg" alt="Screenshot"></a></p>

<p>I need to search for column header that starts with “SKU”  and then “COST”
From there once those are found then I want the whole column… B, E.  But those column letters can change, depends on how it is being exported by the end user. I do not need the rows, just columns.</p>