i have class called dbconnection. I want to call this connection function in the constructor. Usually in Java, i just declare:
private FileName variable = new Filename();
and assign the variable.logOn on any functions.
But now, in authenticate php class, i couldn't do that. So i think i can execute the connection in constructor, I've tried:
public function __construct(){
$conn = new Database();
}
but i couldn't access the $conn var because it's not global variable.
Another method i use is placing below code outside any function.
public $conn = new Database();
but it shows an error.
How properly calling the variable or executing another function from another class in php?
thanks.