Voting

: min(nine, two)?
(Example: nine)

The Note You're Voting On

nicolasbonnici at gmail dot com
5 months ago
Better way to get an associative key value array output.

$output = [];
$lines = array_values(explode(PHP_EOL, $your_csv_string));
$headers = str_getcsv(array_shift($lines));
foreach ($lines as $line) {
$parsedLine = str_getcsv($line);
if (count($headers) !== count($parsedLine)) {
continue;
}
$output[] = array_combine($headers, $parsedLine);
}
var_dump($output);

<< Back to user notes page

To Top