I would like to split my file content e.g
test
$
#
I use str_split
and it works good except it does not save new lines. New lines are saved like space ' '
.
My code:
$fileContent = file_get_contents($fileName);
$iterateableString = str_split($fileContent);
I want to iterate over each character but I want detect if some character is a new line too.
Thanks for advices!
Something like that maybe :
foreach($iterateableString as $str){
if(strstr($str, PHP_EOL)) {
//Do something
}
}