user774528
user774528

Reputation: 187

Line breaks outside <?php tags

My web host's PHP engine is taking everything outside <?php ?> and replacing line breaks with <br>, like so:

<?php

echo 'php1';

?>

Hello
world

<?php
echo 'php2';
?>

The output I get is:

php1
<br><br>Hello<br>world<br><br>php2

All of the other servers I use do this, which is what I want:

php1

Hello
world

php2

Can I disable this behaviour?

Upvotes: 1

Views: 119

Answers (3)

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385144

As far as I can tell, there is no PHP .ini directive to do this.

Contact your webhost and ask them about it, but I suspect that something else is up here.

Upvotes: 1

Lenny Magico
Lenny Magico

Reputation: 1203

Try this, your host is very wierd

<?php
    echo 'php1';
?>
Hello
world
<?php
   echo 'php2';
?>

Upvotes: 0

Jeff
Jeff

Reputation: 12418

Try setting the header to Content-Type: text/plain and see if that helps

<?php
header('Content-Type: text/plain');
?>

Upvotes: 0

Related Questions