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

The Archive Base Latest Questions

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

I have no clue how to phrase this question in a search engine. I’m

  • 0

I have no clue how to phrase this question in a search engine.

I’m a bit confuse how classes use other class’s methods without include/require. I’ve seen this in PHP a couple of time now. Coming from C++ background, I had to include everything in order to use it, so it’s a bit confusing.

But ok here we go:

Say i have improve_db_connection.php:

class improve_db_connection
{

    protected $_connection;

    public function __construct($host, $user, $pwd, $db)
    {
        $this->_connection = @new mysqli($host, $user, $pwd, $db);
        if (mysqli_connect_error()) {
            throw new RuntimeException('Cannot access database: ' .
                mysqli_connect_error());
        }
    }

    public function getResultSet($sql)
    {
        $results = new Pos_MysqlImprovedResult($sql, $this->_connection);
        return $results;
    }
}

The new Pos_MysqlImprovedResult is an instance of Pos_MysqlImprovedResult class, not improve_db_connection. Without declaring the include function to include the class Pos_MysqlImproveResult, the improve_db_connection.php file just knows where the class is.

Is it because the Pos_MysqlImproveResult.php is in the same directory as improve_db_connection.php?

It’s the same thing with Zend Framework. But the files are in subdirectories and such. I have a class in application/modules/SF/models that uses another class function that is in application/modules/SF/models/resources. Is it because the Zend naming convention of these classes that Zend just parse through these files and add it into the php’s __autoload?

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

    Zend Framework uses Zend_Loader to automatically load classes when you reference them, as long as it can find them in a logical place.

    I assume you are running a Zend Application based script, which automatically configures the Autoloader for you and does all the hard work. As your files are located in their logical folders, and the classes have the ZF convention names, ZF will find them and load them when you reference them.

    More information is at the ZF manual:
    http://framework.zend.com/manual/en/zend.loader.html
    http://framework.zend.com/manual/en/zend.application.html

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

Sidebar

Related Questions

Does anyone have any clue why this doesn't work as expected. If i use
Maybe this question is kind of silly but I have no clue how to
Does anyone have a clue how to use this? The documentation as usual is
I have no clue of where to start on this. I've never done any
I have no clue how to validate this string. I am simply supplying an
I got this JSON but have to clue how to extract data from them.
Anyone have a clue what this error message means? An unexpected error occurred while
Does anyone have any clue as to what this might mean? (ClCompile target) ->
Anyone have any clue what this error might actually mean? I'm tripping on a
Does anyone have a clue what this SSRS error means? the only thingi found

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.