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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:26:38+00:00 2026-05-28T05:26:38+00:00

I download a framework and code and I have a question regarding require and

  • 0

I download a framework and code and I have a question regarding require and include vs class_exists.

In the code I download, I see:

require_once('class.php');

As well as:

if(class_exists('class') == false) {  require('class.php'); }

I get require_once means only 1 time and class exists check if the class exists.

My question is: is the second better than the first one? and why?

  • 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-28T05:26:38+00:00Added an answer on May 28, 2026 at 5:26 am

    this condition:

    if(class_exists('class') == false) {  require('class.php'); }
    

    prevent the require_once to be called.

    require_once can be slow if you have a lot of files you include in your project (specially frameworks) because they have to scan the code to make sure the file is not included twice or more. so if you have over 25 file you include and they are nested, require_once will have to check all of them.

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

Sidebar

Related Questions

How can I have my Wix package to download the required .NET Framework when
Is there any well known established framework for C or Java or PHP to
I see examples about code-only POCO for en entity framework 4, but I cannot
The code I have inherited is using the three Entity Framework installers from here:
Can I safely download and install .Net framework 3.5 SP1 without requiring my customers
Does the sync framework allow me to synchronise (download only) the Store Procedures on
I have to use Sync Framework 2.0 in our WPF app that will contain
Well I have two buttons, each image in a span, and one should be
I have an Amazon S3 account and have downloaded the AWSiOSSDK framework/SDK pack. The
I am new to the Zend Framework, and this code is used for downloading

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.