Hello i'm using php and i'm trying to make a database class where the constructor will connect the class to the database and assign the pointer to a class variable. The problem that I have is that every time a new instance of the class is created, the constructor gets called and the code connects to the database. I don't see why it should connect to the database every single time that it is called so how would i go about make a class variable that's the same in all the instances and once it is given the pointer, it won't create it again.
Thanks