In PHP, a class can have static properties and methods. A static is bound to the class blueprint and not the object or any of the objects. Therefore, all of the objects share the static code. If the class has a static property, then any object that changes that property is reflected and changed for every single object of that class.
This is a very important episode. Make sure you watch it at least once. This episode will help you to cement the different of statics and objects.
You access the static with a double colon
::. Within the class, you can use either the class name or the keyword
self is a placeholder for the fully qualified class name. External to the class, you use the class name.
How can you access the static from an object? How is a static different from the internals of an object? Learn more by signing in or Go Pro.
Once upon a time, there was a developer... You! This is going to be a good story...
Total Lab Runtime: 03:04:55
- 1 Lab Introductionfree 08:27
- 2 What is Object-Oriented Programming (OOP)?free 14:14
- 3 What is an object?free 13:30
- 4 Meet the Class Blueprintpro 04:53
- 5 Creating an Objectpro 07:57
- 6 Defining Characteristicspro 10:54
- 7 Putting the Object to Workpro 13:56
- 8 Hiding Away the Complexitypro 22:40
- 9 Working within the Object with $thispro 15:41
- 10 Internal Control of Object Creationpro 15:07
- 11 Class Constantspro 08:58
- 12 Class Staticpro 17:49
- 13 What OOP is Notpro 19:11
- 14 Practical Examplespro 04:52
- 15 Wrap it Uppro 06:46