explode error \\r\\n and \\n in windows and linux server
I have used explode function to get textarea's contain into array based on line. When I run this code in my localhost (WAMPserver 2.1) It work perfectly with this code : $arr=explode("\r\n",$getdata); When I upload to my linux server I need to change above code everytime into : $arr=explode("\n",$getdata); What will be the permanent solution to me. Which common code will work for me for both server? Thank you The constant PHP_EOL contains the platform-dependent linefeed, so you can try this: $arr = explode(PHP_EOL, $getdata); But even better is to normalize the text, because you never know