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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:03:09+00:00 2026-06-10T22:03:09+00:00

I have multiple PHP classes with approximately 20 functions each all in one PHP

  • 0

I have multiple PHP classes with approximately 20 functions each all in one PHP file. Will the server store every class and every function in memory once I include this file?

Or will it only load the class and its functions once I instantiate like so?:

$ajax = new ajax();

Or will the server only cache the functions that I specifically call?:

$ajax->make_request();

I’m wondering if it is OK to have so many classes and functions housed in one single PHP file or if I should put in some type of logic that includes only the classes and functions that are required for the job.

  • 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-10T22:03:10+00:00Added an answer on June 10, 2026 at 10:03 pm

    I think you are a bit confused about how PHP works.

    Every request the PHP parser, parses the requested file, e.g. index.php

    If index.php include‘s another file, PHP will the parse that file.

    Once a PHP file is parsed, it is stored in memory with “byte codes” (an almost machine language), during that request.

    Regardless of how many functions or classes are in a file, it will all be stored in memory for that request.

    There are extensions like APC that cache these parsed byte codes in memory between requests, but they need to be added on to PHP.

    It is however better (in terms of memory usage) to use auto loading for your classes.

    http://php.net/manual/en/language.oop5.autoload.php

    PSR0 is a good set of guidelines for autoloading classes:

    https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md

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

Sidebar

Related Questions

Working on an AJAX website (HTML,CSS,JavaScript, AJAX, PHP, MySQL). I have multiple javascript functions
I'm wanting to detect all objects(classes) defined in a php file (example: flavors.php). The
I used to have one class for one file. For example car.cs has the
I have two PHP classes. One is for connecting to the database, building queries,
I have a simple question regarding PHP Classes. Multiple times I have seen other
Ok I am learning php and trying out classes and functions. Currently I have
I have multiple web applications (PHP) which are being served to different customers from
I have been reading up on multiple PHP frameworks, especially the Zend Framework but
I have a multiple language website, and I use a php get variable to
Im getting an error with my SQL queries in PHP. I have tried multiple

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.