From the course: PHP: Object-Oriented Programming

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Instances

Instances

- [Instructor] In this movie, we'll learn how to use our class definition to create an instance. Let's begin with the definition for this word instance in general use an instance is a single occurrence of something. When we're talking about object-oriented programming that single occurrence of something is a single object created from a class definition. So we're going to be using this word instance a lot and you'll hear the terms object and instance used interchangeably. I'm certain that I'm going to do it but instance is technically the more correct term. So let's see how we create an instance. The first thing of course is we have to have a class definition before we can create an instance of it. The way we create the instance of the class is by using the new keyword followed by the class name. This is called instantiation, or we could use it as a verb and say that we instantiated it. Instantiation is just a…

Contents