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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:20:27+00:00 2026-05-28T06:20:27+00:00

If I am inside a ton of PHP code, instead of coming out of

  • 0

If I am inside a ton of PHP code, instead of coming out of PHP I usually write code which contains variables like so:

echo "This is how I use a ".$variable." inside a string";

but is it more efficient to actually get out of PHP like so:

?>

Should I instead use the <? echo $variable; ?> like this

<? // then back into PHP

Throughout a page there will be lots of instances of code like this as I fill pages with dynamic content, or is this too much of a generalisation?

  • 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-28T06:20:28+00:00Added an answer on May 28, 2026 at 6:20 am

    I only suggest breaking out of php tags when echoing HTML, not just a string.

    This is fine for just a string:

    // You don't need to concat, double quotes interpolate variables
    echo "This is how I use a $variable inside a string";
    

    But with HTML, personally, I like to do this:

    <?php //... ?>
    <div>
        <span>This is how I use a <?=$variable?> inside HTML</span>
    </div>
    <?php //... ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Inside a maven project with some resources configured like this : <webResources> .... <resource>
Inside a tabpanel, there is an object like this: tabpanel.counter = 3; Inisde the
Inside my android map I have three overlays looking like this: what I want
Inside my template function I have the following code: TypeName myFunction() { TypeName result;
inside of my Zend_Db_Table_Rowset Object i found this: [_primary:protected] ... does anybody if theres
Inside a webpage I have an Excel download button, which redirects to a webpage
Before reading please note that I've googled this and read a ton of articles
I have a method which have this signature public static IList<T> GetBy<T>(System.Linq.Expressions.Expression<Func<T, bool>> expression)
I'm recently working on this platform for which a legacy codebase issues a large
I know something like this has been asked before, but the answer was sort

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.