Welcome Guest, Not a member yet? Register   Sign In
What does parent::Controller(); do?
#1

[eluser]Ryuuzaki92[/eluser]
i was wondering what does
Code:
parent::Controller();
in
Code:
class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->view('welcome_message');
    }
}
do. i've seen other frameworks before and they don't require that function when constructing.
#2

[eluser]xwero[/eluser]
The answer you can find in php4 constructors
#3

[eluser]Ryuuzaki92[/eluser]
so i don't have to put it in php5?
#4

[eluser]xwero[/eluser]
No you have to use it because they haven't added a php5 __construct function. So in php4 and php5 you use the same methods so when you change from php4 to php5 ot the other way around your code keeps working.




Theme © iAndrew 2016 - Forum software by © MyBB