Simple, right? Well, this isn't working :-\
$skuList = explode('\n\r', $_POST['skuList']);
Simple, right? Well, this isn't working :-\
$skuList = explode('\n\r', $_POST['skuList']);
For a new line, it's just
$list = explode("\n", $text);
For a new line and carriage return (as in Windows files), it's as you posted. Is your skuList a text area?
Try "\n\r" (double quotes) or just "\n".
If you're not sure which type of EOL you have, run a str_replace before your explode, replacing "\n\r" with "\n".
Cover all cases. Don't rely that your input is coming from a Windows environment.
$skuList = preg_split("/\\n|\\r|\\r\\n/", $_POST['skuList']);
or
$skuList = preg_split('/\n|\r|\r\n/', $_POST['skuList']);
Place the \n in double quotes:
explode("\n", $_POST['skuList']);
In single quotes, if I'm not mistaken, this is treated as \ and n separately.
First of all, I think it's usually \r\n, second of all, those are not the same on all systems. That will only work on windows. It's kind-of annoying trying to figure out how to replace new lines because different systems treat them differently (see here). You might have better luck with just \n.
Lots of things here:
\r\n, not \n\r.\n without the \r (or even in unusual cases, possibly just the \r)Given the last point, you may find preg_split() using all the possible variants will give you a more reliable way of splitting the data than explode(). But alternatively you could use explode() with just \n, and then use trim() to remove any \r characters that are left hanging around.