Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call function inside __construct with php

Tags:

php

construct

A simple PHP problem I couldn't find the answer to.

Is it possible to call a function from the "__construct()"?

For example if I use the My_Controller solution here. If I add my own function below, like if I have a more advanced auth, can I call it from the construct?

like image 784
Vejto Avatar asked Feb 23 '23 17:02

Vejto


1 Answers

Yes, using the format $this->myNewFunction();

like image 125
shanethehat Avatar answered Mar 04 '23 12:03

shanethehat