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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:23:50+00:00 2026-05-23T02:23:50+00:00

let me explain my question this way… I have a piece of html block

  • 0

let me explain my question this way…
I have a piece of html block which I want to reuse it several times in my app.
here I have 2 choices…

number 1 is to define a function in my functions file and put the html code in that function. and every time I need the html I call the function.

number 2 is to write my html inside another file and every time I need it I include it in my script.

what I want to know is which way is faster and use less resources?

btw I use PHP but I don’t think that is relevant. I think my question applies to other languages as well.

  • 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-23T02:23:51+00:00Added an answer on May 23, 2026 at 2:23 am

    In general, it would be faster to include it in a function. If you include the file each time it adds the overhead of needing to open and read the file; with a function it’s just copying a bit of memory around.

    I think that this is usually the case with PHP; certain servers and languages can be configured to optimize the include, but the function is almost always at least as fast.

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

Sidebar

Related Questions

Before you all get pissy about me posting this question again, let me explain
This seems a 'stupid' question, but let me explain. I'm working for a company
Before asking my question, let me explain the context. CONTEXT: I have a web
The easiest way to explain my question may be with an example, so let
I have two examples I have a question about. Let me explain via some
So let me explain my problem a little better now (please reopen this question).
Let me explain what I mean with that question: Lets say I have to
I have a question. It might be sound ridiculous, but let me explain what
Alright let me explain my question with example We have a table that contains
Maybe the question title is not too specific. So let me explain: This is

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.