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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:32:00+00:00 2026-05-19T10:32:00+00:00

Last week I learned that classes can be included in your project by writing

  • 0

Last week I learned that classes can be included in your project by writing an __autoload() function. Then I learned that using an autoloader isn’t only a technique but also a pattern.

Now I’m using the autoloader in my project and I’ve found it very very useful. I was wondering if it could be possible to do the same thing with functions. It could be very useful to forget about including the right PHP file with functions inside it.

So, is it possible to create a function autoloader?

  • 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-19T10:32:01+00:00Added an answer on May 19, 2026 at 10:32 am

    There is no function auto-loader for functions. You have four realistic solutions:

    1. Wrap all functions into namespacing classes (context appropriate). So let’s say you have a function called string_get_letters. You could add that to a class called StringFunctions as a static function. So instead of calling string_get_letters(), you’d call StringFunctions::get_letters(). You would then __autoload those namespaced classes.

    2. Pre-load all functions. Since you’re using classes, you shouldn’t have that many functions, so just pre-load them.

    3. Load functions prior to using them. In each file, require_once the function files that are going to be used in that file.

    4. Don’t use functions in the first place. If you are developing OOP code (which it seems like you are anyway), there should be little to no need for functions at all. Everything you would need a function (or multiple) for, you could build in a OO manner and avoid the need for functions.

    Personally, I’d suggest either 1, 2 or 4 depending on your exact need and the quality and size of your codebase…

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

Sidebar

Related Questions

Last week, we created a program that manages sets of strings, using classes and
I was writing some Unit tests last week for a piece of code that
Last week I learned that Silverlight on the Windows Phone uses a compositor thread
I've spent the last week developing code to connect to a Web Service using
I am using AdMob through AdWhirl and last week running in the simulator showed
I just started using SVN as of last week (TortoiseSVN), is there any SVN
I observed something last week that I did not expect, and will describe below.
In the last week I've created two classes which my team expressed some concerns
Last week i began the honeycomb update for my app and since then the
Last week I published app, this app contained just video links that allows the

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.