Challenge: Implementing a Class with PHP 8 Advanced OOP Features
A hands-on exercise to test your knowledge of the new PHP 8 OOP features.
We'll cover the following
This challenge will extensively test your understanding of the new PHP 8 OOP features. We will use these concepts to create a class to store student information.
Task
Create a class that contains the student’s personal information, such as gender, age, name, etc.
Please use constructor property promotion to create the constructor of this class.
Create a function that is used to display the student’s personal information.
Utilize the
match
function to add “Mr.” and “Ms.” before students’ names based on their gender.Display a "Hello" message to display the personal information in the following format:
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy