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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:34:16+00:00 2026-06-04T01:34:16+00:00

I have a practical question about page load time: Suppose I want the following

  • 0

I have a practical question about page load time:

Suppose I want the following output:

<a class="class-a" href="www.google.com"></a>

Is it faster (with respect to load time and efficiency) to do:

<a class="<?php echo $class_a; ?>" href="<?php echo $url; ?>"></a>

or

echo "<a class='$class_a' href='$url'></a>";

This is a microcosm of a bigger issue– if I’m using echo multiple times on the page is it better to try to condense HTML output into one variable and echo it in one go??

Thanks!

  • 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-06-04T01:34:18+00:00Added an answer on June 4, 2026 at 1:34 am

    Those two really make no difference. One or two echo doesn’t matter. 1000 echo doesn’t matter. Really when you look at the grand scale of things, echos do not matter. I can run 5million echos per second on my laptop in a tight loop. Doing one SQL query that takes 1ms or 2ms to run means you get a difference of 5000 echo calls more or less. That’s how irrelevant it is.

    What you want to do is look at your code with a profiler and find the bottlenecks if you have performance problems, but don’t worry about how many echos you do. And by the way you probably should use something like Twig to print HTML using templates instead of raw PHP like in your example, at least this gives you automatic HTML entities escaping, which protects you against XSS for example.

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

Sidebar

Related Questions

I have a question about jQuery load best practice. Imagine the following situation: $(#div).on('click',
This question is just for a sake of knowledge. I don't have any practical
I have a design/best practice question relating to MVC3. I have a front page
This is a best practices question Let say, I have a class object, like
Simple question on best practice. Say I have: public class Product { public string
I have a question about the architecture of a backbone.js web app. Let's say
I think this is a simple question. Imagine you have a page that initializes
Hi I have a question about best practices vs safe programming in building a
I have an includes.php page that I load at the start of every page
A question I have been thinking about for a while - would Stackoverflow users

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.