How to add a line break within echo in PHP?

0 votes

I was trying to add a line break for a sentence, and I added /n in following code.

echo "Thanks for your email. /n  Your orders details are below:".PHP_EOL;
echo 'Thanks for your email. /n  Your orders details are below:'.PHP_EOL;

For some reasons, the I got server error as the result. How do I fix it?

Oct 27 in PHP by kartik
• 35,420 points
28 views

1 answer to this question.

0 votes

Hello @kartik,

You have to use br when using echo , like this :

echo "Thanks for your email" ."<br>". "Your orders details are below:"

and it will work properly

Hope it helps!!

answered Oct 27 by Niroj
• 76,780 points

Related Questions In PHP

0 votes
1 answer

How can I connect to a Tor hidden service using CURL in PHP?

Hello @kartik, I use Privoxy and cURL to scrape Tor ...READ MORE

answered May 19 in PHP by Niroj
• 76,780 points
865 views
0 votes
1 answer

How do I convert a PDF document to a preview image in PHP?

Hello @kartik, You need ImageMagick and GhostScript <?php $im = new imagick('file.pdf[0]'); $im->setImageFormat('jpg'); header('Content-Type: image/jpeg'); echo ...READ MORE

answered Aug 14 in PHP by Niroj
• 76,780 points
370 views
0 votes
1 answer

How to get a list of user accounts using the command line in MySQL?

Hello @kartik, Use this query: SELECT User FROM mysql.user; Which ...READ MORE

answered Aug 17 in PHP by Niroj
• 76,780 points
56 views
0 votes
1 answer

How to resolve the problem of losing a session after a redirect in PHP?

Hello @kartik, Carry out these usual checks: Make sure session_start(); is ...READ MORE

answered Aug 24 in PHP by Niroj
• 76,780 points
1,291 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 76,780 points
3,460 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 76,780 points
411 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 76,780 points
283 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 76,780 points
4,153 views
0 votes
1 answer

How to check an IP address is within a range of two IPs in PHP?

Hello @kartik, With ip2long() it's easy to convert your addresses ...READ MORE

answered Nov 3 in PHP by Niroj
• 76,780 points
32 views
0 votes
1 answer

How to implement a callback in PHP?

Hello, Implementation of a callback is done like ...READ MORE

answered Apr 15 in PHP by Niroj
• 76,780 points
68 views