- In this chapter, we will learn about static properties…and methods.…Static properties and methods are for behaviors…that are related to the class generally,…or the class as a whole.…These are behaviors that are not tied…to any particular instance of the class.…For this reason, they're often referred to…as class properties or class methods.…We're going to have access to them…by calling them directly on the class…without having to have an instance of the class first.…In order to define them,…we're going to use the keyword static.…So for example, if I have a student class,…I can have a static property for grades…by putting the static keyword in front of it.…
In the same place where we put our visibility modifiers…in the last chapter,…and then I can have a static method called motto…by putting static in front of the word function.…The idea is the grades property is holding data…that is related to the class as a whole.…It's not specific to any one instance of the class.…Presumably if I had an instance of student,…
Author
Released
11/17/2017- Defining classes
- Calling methods
- Class inheritance
- Extending and overriding classes
- Accessing and controlling access to properties and methods
- Static properties and methods
- Magic methods: constructor, destructor, and clone
- Creating a PHP OOP project
Skill Level Intermediate
Duration
Views
Related Courses
-
PHP: Accessing Databases with PDO and MySQLi
with David Powers3h 47m Intermediate -
Consuming RESTful APIs in PHP with Guzzle
with Justin Yost2h 12m Intermediate
-
Introduction
-
Welcome1m 3s
-
-
1. Overview and Project Setup
-
What is OOP?5m 21s
-
Project setup3m 1s
-
-
2. Object Basics
-
Define a class5m 52s
-
Instances6m 13s
-
Class properties9m 56s
-
Class methods5m 12s
-
Refer to an instance3m 54s
-
-
3. Class Inheritance
-
What is inheritance?3m 26s
-
Define a subclass7m 27s
-
Extend and override7m 7s
-
Challenge: Inheritance3m 11s
-
Solution: Inheritance8m 10s
-
-
4. Object Access Control
-
Visibility modifiers9m 18s
-
Beware of overloading5m 37s
-
Setter and getter methods4m 46s
-
Challenge: Access control2m 51s
-
Solution: Access control8m 33s
-
-
5. Static Properties and Methods
-
The static modifier7m 12s
-
Inherited static behaviors5m 45s
-
Class constants4m 43s
-
Refer to the parent class7m 19s
-
Late static bindings7m 12s
-
Challenge: Static references3m 30s
-
Solution: Static references7m 45s
-
-
6. Magic Methods
-
Constructor method4m 46s
-
Constructor arguments7m 51s
-
Destructor method4m 34s
-
Clone method6m 9s
-
Assignment by reference4m 20s
-
Compare objects4m 8s
-
-
7. A PHP OOP Project
-
Project introduction5m 57s
-
Challenge: The bicycle class2m 53s
-
Solution: The bicycle class6m 36s
-
From instances to HTML6m 46s
-
Read from a CSV file7m 44s
-
Improve parseCSV5m 43s
-
From a CSV file to instances2m 33s
-
-
Conclusion
-
Next steps36s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: The static modifier