How to create an array by using the split() function on multiple newlines and returns.
I was having a problem trying to split a string of multiple lines from an online form using the flowing code:
<?php $arry_names = split("\n", $names); ?>
This was producing an unexpected line break. I searched the web to see if anyone had the same problem and found that I needed to check for “returns” (\r) also. So now when I’m splitting data by lines, I use the following code:
<?php $arry_names = split("[\n|\r]", $names); ?>