How to set column limit in csv file?

You could use array_chunk(), for example in file.csv you have:

column1,column2,column3,column4,column5
column1,column2,column3,column4,column5
column1,column2,column3,column4,column5

And your script executes a loop:

$file = file('./file.csv');
$result = array();

foreach($file as $csv)
{
    $s = array_chunk(str_getcsv($csv), 3);
    $result[] = $s[0];
}

The $result array will return only the first three columns of each line.