happy cat image

Start Web Coding

Your First step toward web coding,
Start Web Coding

change UI

Using class

Let's learn how to use class.
Developing a large system means using many variables and functions.
Changing a feature in such an environment can be difficult just to find the code for that feature.
So we use classes to gather specific features.
For example, if you create a class that manages the members of your site, you can declare variables related to members in the class and declare functions.
There's also a social perception that using a class is a programmer who can do more than a developer who doesn't.

How to use class

<?php
    class class name
    {
    }
?>

Let's use a car as an example to see what concept a class is written in.

<?php
    class Car
    {
    }
?>

Created a car class
What would a car look like, wheels, doors, what color, medium, heavy or truck, a car company, and so on?
In the next lesson, we will create wheel variables, door variables, color variables, size variables, and company variables in the car class.
There is a separate name for the variables used within the class. The name is a property.

강좌로 돌아가기