I have an excel template which is used to fill in data. I export this to CSV. One of the fields contains a new line character. When done on a mac it returns a instead or
When I try to explode that text as below:
$skillsets = explode("", $j['skillsets']); // works with CSV exported from MAC
$skillsets = explode("
", $j['skillsets']); // works with CSV exported from WIN
Is there any way I can check for either of them and make sure my explode works for both and
?
Easiest would be to use preg_split
:
$skillsets = preg_split('/(|
)/', $j['skillsets']);
Using a regular expression is not necessary, but this is a very simple case, and you only need to change one line of code.