I have this little problem where i'm getting the content of a CSV using PHP, which works just fine, but then i try to split it using preg_split
like this:
$csv = file_get_contents($file);
$content= preg_split('/\r\n|\r|\n/', $csv);
It does split the content but it also adds an empty array key at the end of the array(cause of that new line) so the array will basicly look like this:
array(
[0] => some;content;here;
[1] => some;other;content;
[3] =>
)
Basicaly my question is: how do i write that regular expression to avoid splitting the last occurrence of that pattern?(and also afterwords i want to split those array keys
by ;
and again i get an empty array key
cause there is a ;
at the end of every string
Thank you for your time! X_X