I am using php 5.3.6.
When I create a new object, the following works:
$my_object = new my_clas();
But what if I wanted to pass values, such as this:
$my_object = new my_clas( $value1 , @value2 );
Where would those values go? Do they go to the __construct function or can I target a specific function?
Note: Right now I have a class with a __construct function and I am doing the above (e.g., passing values) and everything works fine, but I am wondering if this is just a happy accident or something I should worry about.
The will be passed to the
__constructfunction, always. If you want to pass them to another function from there, then call it inside__construct