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.

Challenge: Static references

Challenge: Static references - PHP Tutorial

From the course: PHP: Object-Oriented Programming

Challenge: Static references

(upbeat pop music) - [Instructor] It's time for another challenge assignment. This challenge relates to everything we've done in this chapter on static properties and methods. In order to do this challenge we're going to be reusing the bicycle and the unicycle classes that we created in the last challenge. So the very first thing you want to do is create a new file called challenge_ 04.php, then you'll go and open up challenge_ 03.php and copy those classes for bicycle and unicycle into the new file then you'll be ready for the challenge. There are a couple of different parts to this challenge. The first is that I want you to add a static property called instance count. The idea is it'll be used to store a count of the number of instances that have been created. Once we have that static property we can create a static method called create. The idea behind create is that create is going to create and return a new…

Contents