Hi, I have some troubles with a simple Php example. The following code returns a right output running via Common Line Interface (CLI), but the newlines (\n) are ignored when I try to view it with firefox. What could the reason be? There's no problem when I put the php code between <pre></pre>, but how avoid this? Thanks in advance. Fran <?php $price = 3.95; $tax_rate = 0.08; $tax_amount = $price * $tax_rate; $total_cost = $price + $tax_amount; print 'The tax is '.$tax_amount; print "\n"; // this prints a linebreak print 'The total cost is '.$total_cost; print "\n"; // this prints a linebreak ?>
Hi alma, You can use this one.. It will work on all browser <?php $price = 3.95; $tax_rate = 0.08; $tax_amount = $price * $tax_rate; $total_cost = $price + $tax_amount; print 'The tax is '.$tax_amount; print "<br>"; // this prints a linebreak print 'The total cost is '.$total_cost; print "<br>"; // this prints a linebreak ?>