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

  • SEARCH
  • Home
  • 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 3798962
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:39:29+00:00 2026-05-19T13:39:29+00:00

I have no idea really how to say this, but I can demonstrate it:

  • 0

I have no idea really how to say this, but I can demonstrate it:

<?php
if (true) {
echo "<h1>Content Title</h1>";
}
?>

vs

<?php  if (true) {  ?>
<h1>Content Title</h1>
<?php  }  ?>

What differences are there between the two? Will there be problems caused by not using echo? It just seems super tedious to write echo “html code”; all the time, specially for larger segments of html.

Also, bonus kudos to someone who can rephrase my question better. 🙂

  • 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-19T13:39:30+00:00Added an answer on May 19, 2026 at 1:39 pm

    There’s a small difference between the two cases:

    <?php
    if (true) {
        echo "<h1>Content Title</h1>";
    }
    ?>
    

    Here, because you’re using double quotes in your string, you can insert variables and have their values rendered. For example:

    <?php
    $mytitle = 'foo';
    if (true) {
        echo "<h1>$mytitle</h1>";
    }
    ?>
    

    Whereas in your second example, you’d have to have an echo enclosed in a php block:

    <?php  if (true) {  ?>
        <h1><?php echo 'My Title'; ?></h1>
    <?php  }  ?>
    

    Personally, I use the same format as your second example, with a bit of a twist:

    <?php if (true): ?>
        <h1><?php echo $mytitle; ?></h1>
    <?php endif; ?>
    

    I find that it increases readability, especially when you have nested control statements.

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

Sidebar

Related Questions

I really have no idea what I did to cause this exception, but I
I have really no idea why I'm asking this as this a really completely
I really have no idea why I'm struggling with this so much. I'm scraping
I really have no idea how to go about this. So far all I
I have a really hard time searching for this, because I have no idea
I understand this should be really easy but I can't find my way around
Sorry about the vague title, but I really don't know how to describe this
I really have only a fair idea of what I am doing. Sorry. This
I am writing this because I have really no idea why this is happening.
So, maybe this is a bad design; I don't know. But say I have

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.