MrColin
Platinum Member
I'm teaching myself php (or at least trying) from various resources, however (as is always the case with this sort of approach) my environment behaves differently than any example/book/tutorial I can find.
I've got a LAMP server that works great for some packaged apps already however trying out some examples i find my output is different than sources suggest.
using this example:
This should give output on separate lines, but for me it is all on one line. Using google I can find all kinds of stuff related to removing unwanted newlines, but nothing on why newlines are inexplicably ignored.
Any ideas?
I've got a LAMP server that works great for some packaged apps already however trying out some examples i find my output is different than sources suggest.
using this example:
Code:
<?php
if ($handle = opendir('/path/to/files')) {
echo "Directory handle: $handle\n";
echo "Entries:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
echo "$entry\n";
}
/* This is the WRONG way to loop over the directory. */
while ($entry = readdir($handle)) {
echo "$entry\n";
}
closedir($handle);
}
?>
This should give output on separate lines, but for me it is all on one line. Using google I can find all kinds of stuff related to removing unwanted newlines, but nothing on why newlines are inexplicably ignored.
Any ideas?