I have values separated by line breaks. Sometimes an empty value can be added, causing 2 PHP_EOL. But some values (only numeric) may end by 0 (Like 4950).
I am using this code :
foreach($myVar as $key => $value) {
while(substr($value, -1, 1) == PHP_EOL) {
$value = substr($value, -1, 1);
}
}
But it seems like PHP_EOL == 0, cutting off the last "0" of my values (e.g. 4950 -> 495).
Try this code to figure this out :
if(PHP_EOL == 0) {
echo "CONV0<br>";
}
if(PHP_EOL == 1) {
echo "CONV1<br>";
}
What is the good way to remove every PHP_EOL without cutting off 0 ? Why do PHP_EOL == 0 ? That's strange !