Reading CSV values and showing them in PHP

Not too hard really…

$csvdata = file_get_contents($filepath);
$lines = explode("\n", $csvdata); // split data by new lines
foreach ($lines as $i => $line) {
    $values = explode(',', $line); // split lines by commas
    // set values removing them as we ago
    $linevalues[$i]['name'] = trim($values[0]); unset($values[0]);
    $linevalues[$i]['country'] = trim($values[1]); unset($values[1]);
    $linevalues[$i]['color'] = trim($values[2]); unset($values[2]);
    // assign remaining columns (array)
    $linevalues[$i]['pet'] = array_values($values); 
}
print_r($linevalues); // see the result

error code: 523