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 3314086
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:11:26+00:00 2026-05-17T22:11:26+00:00

very simple question. Lol i am embarassed to ask this cause i am usually

  • 0

very simple question. Lol i am embarassed to ask this cause i am usually very good with php but what are the ways to display html inside of php? for example:


<? if($flag): ?>
  <div>This will show is $flag is true </div>
<? endif; ?>

OR


<?
  if($flag)
    echo '<div>This will show is $flag is true </div>';
?>

I know that there are at least 2 other ways i just cannot remember them atm…
Help is def. appreciated in advance!! =D

  • 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-17T22:11:27+00:00Added an answer on May 17, 2026 at 10:11 pm

    Here’s how a heredoc could be used:

    if($flag)
    {
        echo <<<HTML
            <div>This will show if \$flag is true </div>
    HTML;
    
    }
    

    If you don’t want variable interpolation, you have to escape possible varnames as I have above. Alternatively, you can use a nowdoc with PHP 5.3 onwards:

    if($flag)
    {
        echo <<<'HTML'
            <div>This will show if $flag is true </div>
    HTML;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey,...very simple question I usually write php but happen to be programming with ASP.NET
This seems like a very simple question, but I've only found complicated answers. I've
This is hopefully a very simple question, but one a lot of Googling has
This is a very simple question but All is such a bad keyword to
Very simple question but I'm quite new to JS and this is not easy
This might be a very simple question but i am unable to get it.
Very Simple Question but I am finding it hard to get a good answer
Very simple question: Is it possible to display a var in .html, using jQuery?
very simple question but I couldn't find an answer for this: I have the
Maybe this is a very simple question, but I just can not figure out.

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.