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

  • Home
  • SEARCH
  • 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 5989603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:07:32+00:00 2026-05-22T23:07:32+00:00

I was just looking at the CodeIgniter source code and I came across a

  • 0

I was just looking at the CodeIgniter source code and I came across a couple of things that I can’t seem to figure out; I’m not sure what they mean, and since they’re mostly like one or two symbols it makes it hard to search on both google and stackoverflow for them.

One thing that I came across quite a lot is this:

$this->config =& get_config();

I have never really encountered the =& (or mostly the &) in PHP before. What does this mean exactly? Are they assigning an instance of get_config to $this->config? I assume the $this->config comes from a declaration at the top of the file where it says var $config = array();

I went looking for the get_config() function, and I found the following line:

function &get_config($replace = array())

Here, my question is pretty much the same: what does the & stand for and what does it do? I see these two things (& and =&) a lot throughout the CI core files.

Something else I was wondering about is their commenting ‘style’. Every function starts with a comment block, here’s an example:

 /**
 * Set HTTP Status Header
 *
 * @access  public
 * @param   int     the status code
 * @param   string
 * @return  void
 */

Is this generated by some plugin or library? It sounds like a lot of hassle to do this manually. I haven’t checked out stuff like PHPDoc, but could this be something similar (or PHPDoc)? It seems useful, if it generates that automatically? Heehee.

Onto the next question. I see different functions prefixed by underscores. There’s the obvious __construct but there’s also functions like _set_default_controller(); and _set_routing(); Do these underscores have any special meaning? I know the double underscore is used for something called ‘magic methods’ (I’m thinking about __get and __set since those are the ones I’ve used myself). Do they have any ‘special’ technical meaning or is this pure semantics? Enlighten me if possible.

Last but not least, in the controller core file I saw this:

class CI_Controller {

    private static $instance;

    public function __construct()
    {
        self::$instance =& $this;
                // goes on

The line of interest here is self::$instance =& $this; What does this mean? Does it set $thisto an instance of itself (wiiiiiild guess, haha), so we can use $this? Or does that make no sense? Actually it doesn’t, since in the very basic MVC boilerplate I use myself for basic websites, I use $this without any of that advanced stuff.

Can anyone offer some insight here? I’d be grateful. Thanks a lot in advance.

  • 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-22T23:07:32+00:00Added an answer on May 22, 2026 at 11:07 pm
    1. The & operator there is assigning a value by reference, meaning further use of this variable will reference the original value, not the assigned one. Reference (no pun intended): http://php.net/manual/en/language.references.php

    2. The comments are phpdoc style, they aren’t generated themselves, but can be handy in creating docs with phpdoc or other software, and picking up expected params and return values in an IDE.

    3. The underscore usually means the method is private. When used in a CI controller, it means the method is inaccessible by url. Related: What's the deal with a leading underscore in PHP class methods?

    4. You are pretty much correct. The function get_instance() will return the $instance property of Controller.

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

Sidebar

Related Questions

I am just looking at the source code of BlogEngine.Net and was intrigued at
Looking at frameworks I came across Codeigniter. I was wondering what the proper process
Just looking for the first step basic solution here that keeps the honest people
Just looking for the relevant documentation. An example is not necessary, but would be
Just looking at: (Source: https://xkcd.com/327/ ) What does this SQL do: Robert'); DROP TABLE
I am just looking at setting a up a custom UIViewController programatically (see code
I am just looking for a open-source software or plug-ins implemented for NetBeans or
Just looking at ways of getting named constants in python. class constant_list: (A_CONSTANT, B_CONSTANT,
I was just looking through some information about Google's protocol buffers data interchange format.
I'm just looking for a simple, concise explanation of the difference between these two.

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.