2
How do I initialize a PHP class while passing a parameter. Same as PDO that is initialized by passing parameters as data for the database connection.
In my case I just want to pass an ID on startup. Ex:
$user = new User($id);
And after passing the parameter using the Construct function to load all the information of that user, without the need to call some function manually for such action.
What does the "protected" ?
– ayelsew
@Thomsontorvalds protected is to say that only this and the classes that extend this have access to this property, you can put private so that it is only this if you prefer
– Miguel
@Thomsontorvalds, I’ve completed a little more to see for sure what you can do
– Miguel