Possible Duplicate:
Why does PHP echo'd text lose it's formatting?
I got strange problem. Let's say I got code like this:
<?php
class Bar
{
private $foo;
function __construct ($foo)
{
$this->foo = $foo;
}
public function testFoo($obj)
{
echo $obj->foo . PHP_EOL;
}
}
$obj = new Bar("obj");
$obj2 = new Bar("obj2");
$obj->testFoo($obj);
$obj->testFoo($obj2);
?>
And well instead of getting expected result which is:
obj
obj2
This is what I get:
obj obj2
It's just like PHP_EOL represents blank space. I also tried to use "\n" but this one works same. I'm using latest XAMPP.
If you are viewing this in your browser, it's because browsers interpret newlines in HTML as regular space characters.
In HTML you need to use <br>
for forcing a line break.