I’m reading few books about PHP and getting stared to grab the basics. I came across “instantiated” and “initialised” words. I can not find an example which explains them.
What is the difference between “instantiated” and “initialised” in PHP ? What do they mean ? How to use them ? What’s the purpose of using them ?
Provide an example if possible.
You
instantiatean object from a class. I.e. you create aninstance(hence the name). In code:You
initialisea variable, which means “giving it its initial (hence the name) value”.In fact, when you
instantiate, you also ofteninitialiseit (in the constructor). For example:Instantiation is a object-oriented programming term. Initialisation is used in all languages. Both terms are certainly not limited to PHP.