• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Library Constructors

Hey could anyone help me understand the difference between the two different types of constructors available to use with code igniter?

In my c++ course we did constructors for a class by doing the function class() like this:

class Test {
        function Test(){
                constructor here


this works but I have noticed that in code igniter libraries and in php in general you often see this:

function __construct(){


I noticed the second one will overwrite the first one if they are both in a library but what is the difference? Which one should I be using?


PHP5 = __construct() OR same_name_as_class()

PHP4 = same_name_as_class()

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.