Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 737381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:42:54+00:00 2026-05-14T07:42:54+00:00

For the most part, when I want to display some HTML code to be

  • 0

For the most part, when I want to display some HTML code to be actually rendered I would use a ‘close PHP’ tag, write the HTML, then open the PHP again. eg

<?php
// some php code
?>
<p>HTML that I want displayed</p>
<?php
// more php code
?>

But I have seen lots of people who would just use echo instead, so they would have done the above something like

<?php
// some php code
echo("<p>HTML that I want displayed</p>");
// more php code
?>

Is their any performance hit for dropping out and back in like that? I would assume not as the PHP engine would have to process the entire file either way.

What about when you use the echo function in the way that dose not look like a function, eg

echo "<p>HTML that I want displayed</p>"

I would hope that this is purely a matter of taste, but I would like to know if I was missing out on something. I personally find the first way preferable (dropping out of PHP then back in) as it helps draw a clear distinction between PHP and HTML and also lets you make use of code highlighting and hinting for your HTML, which is always handy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:42:54+00:00Added an answer on May 14, 2026 at 7:42 am

    The first type is preferable, exactly for the reasons you mentioned.

    Actually, echoing out whole chunks of html is considered bad practice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use Tomcat's error-page directive to display various different error pages
I have for the most part successfully embedded firefox/xulrunner into our c# application, but
I believe I understand properties for the most part. My question is, if I
I'm a C# developer for the most part. Back in college I had classes
I have mastered for the most part taking my designs and coding them as
TortoiseSVN is nice for the most part, but one thing that blows in a
I've integrated twitter4j into an android app and for the most part it works
I'm trying to build a QueryString Reader from my app.config in the most part
I'm using js2-mode for working with javascript in emacs and for the most part
I have an order-statistic augmented red black tree. it works for the most part.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.