method fromCsv documentation in bbn\X

Formats a CSV line(s) and returns it as an array.

Adapted from http://us3.php.net/manual/en/function.fputcsv.php#87120

Example

X::dump(X::fromCsv( '"141";"10/11/2002";"350.00";"1311742251" "142";"12/12/2002";"349.00";"1311742258"' )); // [ [ "141", "10/11/2002", "350.00", "1311742251", ], [ "142", "12/12/2002", "349.00", "1311742258", ], ] function(string $st, $del = ';', $enc = '"', $sep = ' ') { $r = []; $lines = explode($sep, $st); foreach ($lines as $line) { $r[] = str_getcsv($line, $del, $enc); } return $r; }

Formats a CSV line(s) and returns it as an array. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.